diff --git a/.eslintrc.json b/.eslintrc.json index 06cc47d9a..2f936c714 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,7 +24,11 @@ { "files": ["*.ts", "*.tsx"], "extends": ["plugin:@nrwl/nx/typescript"], - "rules": {} + "rules": { + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/no-explicit-any": "off" + } }, { "files": ["*.js", "*.jsx"], diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml new file mode 100644 index 000000000..5dc22b08f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -0,0 +1,79 @@ +name: "🐛 Bug Report" +description: Create a bug report to help us improve. +title: "🐛 [BUG] - " +labels: [ + "bug" +] +body: + - type: textarea + id: expected-behaviour + attributes: + label: "Expected Behaviour" + description: Please describe the behavior you are expecting + placeholder: Short and explicit description of your desired behaviour... + validations: + required: true + - type: textarea + id: current-behaviour + attributes: + label: "Current Behaviour" + description: Please describe the current behavior + placeholder: What is the current behavior?... + validations: + required: true + - type: textarea + id: reprod + attributes: + label: "Reproduction steps" + description: Please enter an explicit description of your issue + value: | + 1. Go to '...' + 2. Invoke function '...' + 3. See error + render: bash + validations: + required: true + - type: textarea + id: screenshot + attributes: + label: "Screenshots" + description: If applicable, add screenshots to help explain your problem. + value: | + ![DESCRIPTION](LINK.png) + render: bash + validations: + required: false + - type: textarea + id: logs + attributes: + label: "Relevant Logs" + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: bash + validations: + required: false + - type: dropdown + id: dapp-env + attributes: + label: "Dapp Env" + description: What is the impacted DApp environment ? + multiple: true + options: + - Prod (app.push.org) + - Staging (staging.push.org) + - Dev (dev.push.org) + validations: + required: true + - type: dropdown + id: browsers + attributes: + label: "Browsers" + description: What browsers are you seeing the problem on ? + multiple: true + options: + - Firefox + - Chrome + - Safari + - Microsoft Edge + - Opera + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/DOCUMENTATION_README_ISSUE.yml b/.github/ISSUE_TEMPLATE/DOCUMENTATION_README_ISSUE.yml new file mode 100644 index 000000000..36ad7abc6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/DOCUMENTATION_README_ISSUE.yml @@ -0,0 +1,35 @@ +name: "✏️ Documentation/Readme Enhancement" +description: Suggest an enhancement in documentation/readme. +title: "✏️ [Documentation/Readme Enhancement] - <title>" +labels: [ + "documentation" +] +body: + - type: textarea + id: expected-behaviour + attributes: + label: "Expected Behaviour" + description: Please describe the behavior you are expecting + placeholder: Short and explicit description of your desired behaviour... + validations: + required: false + - type: textarea + id: current-behaviour + attributes: + label: "Current Behaviour" + description: Please describe the current behavior + placeholder: What is the current behavior?... + validations: + required: false + - type: textarea + id: reprod + attributes: + label: "Steps to Reproduce" + description: Please enter an explicit description of your issue + value: | + 1. Go to '...' + 2. Invoke function '...' + 3. See error + render: bash + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/IMPROVEMENT_PROPOSAL.yml b/.github/ISSUE_TEMPLATE/IMPROVEMENT_PROPOSAL.yml new file mode 100644 index 000000000..3f062784e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/IMPROVEMENT_PROPOSAL.yml @@ -0,0 +1,40 @@ +name: "😈 Improvement Proposal" +description: Suggest improvement,whether new or built upon existing features. +title: "😈 [Improvement Proposal] - <title>" +labels: [ + "Improvement proposal" +] +body: + - type: input + id: proposal-name + attributes: + label: "Proposal name" + description: Brief title or summary of the proposed improvement. + placeholder: Summary of the proposal improvement. + validations: + required: true + - type: textarea + id: description + attributes: + label: "Describe the Proposal" + description: Please describe detailed description of the improvement, including the problem it solves and the benefits it brings. + placeholder: Detailed description of your desired proposal... + validations: + required: true + - type: textarea + id: usecase + attributes: + label: "Use Case" + description: Please explain the specific use cases or scenarios where this improvement would be valuable.. + placeholder: List down the use case. + validations: + required: true + - type: textarea + id: current-limitations + attributes: + label: "Current Limitations" + description: Any existing limitations, issues, or challenges with the SDK that the proposed improvement aims to address. + placeholder: Overview for the current problem/limitations. + validations: + required: true + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/OTHER.yml b/.github/ISSUE_TEMPLATE/OTHER.yml new file mode 100644 index 000000000..21941d88a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/OTHER.yml @@ -0,0 +1,27 @@ +name: "👾 Other" +description: Something that doesn't belong elsewhere. +title: "👾 [Other] - <title>" +labels: [ + "Other" +] +body: + - type: textarea + id: description + attributes: + label: "Description" + description: Please describe something + placeholder: Detailed description of what you wanna share... + validations: + required: true + - type: dropdown + id: dapp-env + attributes: + label: "Dapp Env" + description: What is the impacted DApp environment ? + multiple: true + options: + - Prod (app.push.org) + - Staging (staging.push.org) + - Dev (dev.push.org) + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/QUESTION_SUPPORT.yml b/.github/ISSUE_TEMPLATE/QUESTION_SUPPORT.yml new file mode 100644 index 000000000..2085f49e5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/QUESTION_SUPPORT.yml @@ -0,0 +1,15 @@ +name: "❓ Question or Support Request" +description: Questions and requests for support. +title: "❓ [Question/Support] - <title>" +labels: [ + "support" +] +body: + - type: textarea + id: support-request + attributes: + label: "Question or Support Request" + description: Describe your question or ask for support. + placeholder: Detailed description of your question/support request... + validations: + required: true \ No newline at end of file diff --git a/README.md b/README.md index 6cc5ea396..fe14fdc1b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ <h4 align="center"> - <a href="discord.gg/pushprotocol"> + <a href="https://discord.com/invite/pushprotocol"> <img src="https://img.shields.io/badge/discord-7289da.svg?style=flat-square" alt="discord"> </a> <a href="https://twitter.com/pushprotocol"> @@ -177,7 +177,7 @@ node main - **[Website](https://push.org)** To checkout our Product. - **[Docs](https://docs.push.org/developers/)** For comprehensive documentation. - **[Blog](https://medium.com/push-protocol)** To learn more about our partners, new launches, etc. -- **[Discord](discord.gg/pushprotocol)** for support and discussions with the community and the team. +- **[Discord](https://discord.com/invite/pushprotocol)** for support and discussions with the community and the team. - **[GitHub](https://github.com/ethereum-push-notification-service)** for source code, project board, issues, and pull requests. - **[Twitter](https://twitter.com/pushprotocol)** for the latest updates on the product and published blogs. @@ -196,7 +196,7 @@ Read how you can contribute <a href="https://github.com/ethereum-push-notificati Not sure where to start? Join our discord and we will help you get started! -<a href="discord.gg/pushprotocol" title="Join Our Community"><img src="https://www.freepnglogos.com/uploads/discord-logo-png/playerunknown-battlegrounds-bgparty-15.png" width="200" alt="Discord" /></a> +<a href="https://discord.com/invite/pushprotocol" title="Join Our Community"><img src="https://www.freepnglogos.com/uploads/discord-logo-png/playerunknown-battlegrounds-bgparty-15.png" width="200" alt="Discord" /></a> ## License Check out our License <a href='https://github.com/ethereum-push-notification-service/push-sdk/blob/main/license-v1.md'>HERE </a> diff --git a/package.json b/package.json index 49514fb87..c6d4e222a 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,6 @@ "react-test-renderer": "17.0.2", "ts-jest": "27.1.4", "ts-node": "9.1.1", - "typescript": "~4.6.2" + "typescript": "5.0.2" } } diff --git a/packages/examples/sdk-backend-node/.env.sample b/packages/examples/sdk-backend-node/.env.sample index 550450212..a444eee26 100644 --- a/packages/examples/sdk-backend-node/.env.sample +++ b/packages/examples/sdk-backend-node/.env.sample @@ -43,8 +43,8 @@ VIDEO_CHAIN_ID=your_video_chain_id # VIDEO SENDER ADDRESS VIDEO_SENDER_ADDRESS=your_video_sender_address -# VIDEO RECIPEINT ADDRESS -VIDEO_RECIPEINT_ADDRESS=your_video_recipeint_address +# VIDEO RECIPIENT ADDRESS +VIDEO_RECIPIENT_ADDRESS=your_video_recipient_address # VIDEO CHAT ID VIDEO_CHAT_ID=your_video_chat_id \ No newline at end of file diff --git a/packages/examples/sdk-backend-node/chat/chat.lowlevel.ts b/packages/examples/sdk-backend-node/chat/chat.lowlevel.ts new file mode 100644 index 000000000..852b62153 --- /dev/null +++ b/packages/examples/sdk-backend-node/chat/chat.lowlevel.ts @@ -0,0 +1,667 @@ +import * as PushAPI from '@pushprotocol/restapi'; +import { createSocketConnection, EVENTS } from '@pushprotocol/socket'; +import { ethers } from 'ethers'; +import { + adjectives, + animals, + colors, + uniqueNamesGenerator, +} from 'unique-names-generator'; +import { ENV } from '../types'; +import { config } from '../config'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { createWalletClient, http } from 'viem'; +import { goerli } from 'viem/chains'; + +// CONFIGS +const { env, showAPIResponse } = config; + +/***************** SAMPLE SIGNER GENERATION *********************/ +/** + * USING VIEM + */ +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const signerAddress = signer.account.address; +const secondSigner = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const secondSignerAddress = secondSigner.account.address; +// Dummy Wallet Addresses +const randomWallet1 = privateKeyToAccount(generatePrivateKey()).address; +const randomWallet2 = privateKeyToAccount(generatePrivateKey()).address; +const randomWallet3 = privateKeyToAccount(generatePrivateKey()).address; + +/** + * USING ETHERS + */ +// // Random Wallet Signers +// const signer = ethers.Wallet.createRandom(); +// const signerAddress = signer.address; +// const secondSigner = ethers.Wallet.createRandom(); +// const secondSignerAddress = secondSigner.address; +// // Dummy Wallet Addresses +// const randomWallet1 = ethers.Wallet.createRandom().address; +// const randomWallet2 = ethers.Wallet.createRandom().address; +// const randomWallet3 = ethers.Wallet.createRandom().address; + +/************************************************************* */ + +// Group Chat Data +const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], +}); +const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], +}); +const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + +// Push Chat - Run Chat Use cases +export const runChatLowlevelUseCases = async (): Promise<void> => { + console.log('PushAPI.user.create'); + await PushAPI_user_create(); + + console.log('PushAPI.user.get'); + await PushAPI_user_get(); + + console.log('PushAPI_chat_decryptPGPKey'); + await PushAPI_chat_decryptPGPKey(); + + console.log('PushAPI.chat.chats'); + await PushAPI_chat_chats(); + + console.log('PushAPI.chat.requests'); + await PushAPI_chat_requests(); + + console.log('PushAPI.chat.send'); + const TargetChatId = await PushAPI_chat_send(); + + console.log('PushAPI.chat.approve'); + await PushAPI_chat_approve(); + + console.log('PushAPI chat Video call Notification'); + await PushAPI_chat_video_call_notification(TargetChatId); + + console.log('PushAPI.chat.createGroup'); + const { chatId, name } = await PushAPI_chat_createGroup(); + + console.log('PushAPI.chat.conversationHash'); + await PushAPI_chat_conversationHash(); + + console.log('PushAPI_chat_history'); + await PushAPI_chat_history(); + + console.log('PushAPI.chat.latest'); + await PushAPI_chat_latest(); + + console.log('PushAPI.chat.updateGroup'); + await PushAPI_chat_updateGroup(chatId); + + console.log('PushAPI.chat.getGroupByName'); + await PushAPI_chat_getGroupByName(name); + + console.log('PushAPI.chat.getGroup'); + await PushAPI_chat_getGroup(chatId); + + console.log('PushAPI.chat.decryptConversation'); + await PushAPI_chat_decryptConversation(); + + console.log('Push Chat - PushSDKSocket()'); + await PushChatSDKSocket(); +}; + +// Push Chat - PushAPI.user.create +async function PushAPI_user_create(silent = !showAPIResponse) { + const user = await PushAPI.user.create({ + signer: signer, + env: env as ENV, + }); + + const user_2 = await PushAPI.user.create({ + signer: secondSigner, + env: env as ENV, + }); + + console.log('PushAPI_user_create | Response - 200 OK'); + if (!silent) { + console.log(user); + console.log(user_2); + } + + return user; +} + +// Push Chat - PushAPI.user.get +async function PushAPI_user_get(silent = !showAPIResponse) { + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + console.log('PushAPI_user_get | Response - 200 OK'); + + if (!silent) { + console.log(user); + } +} + +// Push Chat - PushAPI.chat.decryptPGPKey +async function PushAPI_chat_decryptPGPKey(silent = !showAPIResponse) { + // get user and derive encrypted PGP key + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // decrypt the PGP Key + const pgpKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + console.log('PushAPI_chat_decryptPGPKey | Response - 200 OK'); + if (!silent) { + console.log(pgpKey); + } +} + +// Push Chat - PushAPI.chat.chats +async function PushAPI_chat_chats(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Actual api + const response = await PushAPI.chat.chats({ + account: `eip155:${signerAddress}`, + toDecrypt: true, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_chats | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.requests +async function PushAPI_chat_requests(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Actual api + const response = await PushAPI.chat.requests({ + account: `eip155:${signerAddress}`, + toDecrypt: true, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_requests | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.conversationHash +async function PushAPI_chat_conversationHash(silent = !showAPIResponse) { + // conversation hash are also called link inside chat messages + const conversationHash = await PushAPI.chat.conversationHash({ + account: `eip155:${signerAddress}`, + conversationId: `eip155:${secondSignerAddress}`, // 2nd address + env: env as ENV, + }); + + console.log('PushAPI_chat_conversationHash | Response - 200 OK'); + if (!silent) { + console.log(conversationHash); + } +} + +// Push Chat - PushAPI.chat.latest +async function PushAPI_chat_latest(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Fetch conversation hash + // conversation hash are also called link inside chat messages + const conversationHash = await PushAPI.chat.conversationHash({ + account: `eip155:${signerAddress}`, + conversationId: `eip155:${secondSignerAddress}`, // 2nd address + env: env as ENV, + }); + + // Actual API + const response = await PushAPI.chat.latest({ + threadhash: conversationHash.threadHash, // get conversation hash from conversationHash function and send the response threadhash here + account: `eip155:${signerAddress}`, + toDecrypt: true, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_latest | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.history +async function PushAPI_chat_history(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Fetch conversation hash + // conversation hash are also called link inside chat messages + const conversationHash = await PushAPI.chat.conversationHash({ + account: `eip155:${signerAddress}`, + conversationId: `eip155:${secondSignerAddress}`, // 2nd address + env: env as ENV, + }); + + // Actual API + const response = await PushAPI.chat.history({ + threadhash: conversationHash.threadHash, // get conversation hash from conversationHash function and send the response threadhash here + account: `eip155:${signerAddress}`, + limit: 5, + toDecrypt: true, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_history | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.send +// // Will send a message to the user or chat request in case user hasn't approved them +async function PushAPI_chat_send(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Actual api + const response = await PushAPI.chat.send({ + messageObj: { + content: "Gm gm! It's me... Mario", + }, + messageType: 'Text', // can be "Text" | "Image" | "File" | "GIF" + receiverAddress: secondSignerAddress, + + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_send | Response - 200 OK'); + if (!silent) { + console.log(response); + } + return response.chatId; +} + +// Push Chat - Approve +async function PushAPI_chat_approve(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${secondSignerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: secondSigner, + }); + + // Actual api + const approve = await PushAPI.chat.approve({ + status: 'Approved', + senderAddress: signerAddress, // receiver's address or chatId of a group + + signer: secondSigner, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_approve | Response - 200 OK'); + if (!silent) { + console.log(approve); + } +} + +// Push Chat - PushAPI.chat.createGroup +async function PushAPI_chat_createGroup( + silent = !showAPIResponse +): Promise<{ chatId: string; name: string }> { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Actual API + // Convert image to base 64 and pass + const response = await PushAPI.chat.createGroup({ + groupName, + groupDescription, + members: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: true, + + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_createGroup | Response - 200 OK'); + if (!silent) { + console.log(response); + } + return { chatId: response.chatId, name: response.groupName }; +} + +// Push Chat - PushAPI.chat.updateGroup +async function PushAPI_chat_updateGroup( + chatId: string, + silent = !showAPIResponse +) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Actual API + // Convert image to base 64 and pass + // This is an idempotent operation, meaning it requires all group info to be passed no matter if only few things change + // Why so? To ensure that verificationProof always is able to replicate the current group info (trustless since signature is stored with the info) + const response = await PushAPI.chat.updateGroup({ + chatId, + groupName, + groupDescription, + members: [ + `eip155:${randomWallet1}`, + `eip155:${randomWallet2}`, + `eip155:${randomWallet3}`, + `eip155:${signerAddress}`, + ], + groupImage, + admins: [`eip155:${signerAddress}`], // takes signer as admin automatically, add more if you want to + + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + console.log('PushAPI_chat_updateGroup | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.getGroupByName +async function PushAPI_chat_getGroupByName( + name: string, + silent = !showAPIResponse +) { + const response = await PushAPI.chat.getGroupByName({ + groupName: name, + env: env as ENV, + }); + + console.log('PushAPI_chat_getGroupByName | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.getGroup +async function PushAPI_chat_getGroup( + chatId: string, + silent = !showAPIResponse +) { + const response = await PushAPI.chat.getGroup({ + chatId: chatId, + env: env as ENV, + }); + + console.log('PushAPI_chat_getGroup | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Chat - PushAPI.chat.decryptConversation +async function PushAPI_chat_decryptConversation(silent = !showAPIResponse) { + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${signerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: signer, + }); + + // Fetch conversation hash + // conversation hash are also called link inside chat messages + const conversationHash = await PushAPI.chat.conversationHash({ + account: `eip155:${signerAddress}`, + conversationId: `eip155:${secondSignerAddress}`, // 2nd address + env: env as ENV, + }); + + // Chat History + const encryptedChats = await PushAPI.chat.history({ + threadhash: conversationHash.threadHash, // get conversation hash from conversationHash function and send the response threadhash here + account: `eip155:${signerAddress}`, + limit: 5, + toDecrypt: false, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + + // Decrypted Chat + const decryptedChat = await PushAPI.chat.decryptConversation({ + messages: encryptedChats, // array of message object fetched from chat.history method + connectedUser: user, // user meta data object fetched from chat.get method + pgpPrivateKey: pgpDecrpyptedPvtKey, //decrypted private key + env: env as ENV, + }); + + console.log('PushAPI_chat_decryptConversation | Response - 200 OK'); + if (!silent) { + console.log(decryptedChat); + } +} + +// Push Chat - Socket Connection +async function PushChatSDKSocket(silent = !showAPIResponse) { + const pushSDKSocket = createSocketConnection({ + user: `eip155:${signerAddress}`, + socketType: 'chat', + socketOptions: { autoConnect: true, reconnectionAttempts: 3 }, + env: env as ENV, + }); + + if (!pushSDKSocket) { + throw new Error('Socket not connected'); + } + + pushSDKSocket.on(EVENTS.CONNECT, async () => { + console.log('Socket Connected - will disconnect after 4 seconds'); + + // send a chat from other wallet to this one to see the result + // Fetch user + const user = await PushAPI.user.get({ + account: `eip155:${secondSignerAddress}`, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + + signer: secondSigner, + }); + + // Actual api + const response = await PushAPI.chat.send({ + messageContent: "Gm gm! It's me... Mario", + messageType: 'Text', + receiverAddress: `eip155:${signerAddress}`, + + signer: secondSigner, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, + }); + console.log('PushAPI_chat_send | Response - 200 OK'); + }); + + pushSDKSocket.on(EVENTS.DISCONNECT, () => { + console.log('Socket Disconnected'); + }); + + pushSDKSocket.on(EVENTS.CHAT_RECEIVED_MESSAGE, (message) => { + // feedItem is the notification data when that notification was received + console.log('Incoming Push Chat message from Socket'); + if (!silent) { + console.log(message); + } + + // disconnect socket after this, not to be done in real implementations + pushSDKSocket.disconnect(); + }); + + const delay = (ms: number) => + new Promise((resolve) => setTimeout(resolve, ms)); + await delay(4000); +} + +async function PushAPI_chat_video_call_notification( + chatId: string, + silent = !showAPIResponse +) { + // Fetch user + const user = await PushAPI.user.get({ + account: signerAddress, + env: env as ENV, + }); + + // Decrypt PGP Key + const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + signer: signer, + }); + // get PGP KEy + const apiResponse = await PushAPI.payloads.sendNotification({ + senderType: 1, + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + chatId: chatId, + type: 3, // target + identityType: 2, // direct payload + notification: { + title: `VC TITLE:`, + body: `VC BODY`, + }, + payload: { + title: `payload title`, + body: `sample msg body`, + cta: '', + img: '', + additionalMeta: { + type: '1+1', + data: 'Random DATA', + domain: 'push.org', + }, + }, + recipients: secondSignerAddress, // recipient address + channel: signerAddress, // your channel address + env: env as ENV, + }); + + console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); + if (!silent) { + console.log(apiResponse); + } +} diff --git a/packages/examples/sdk-backend-node/chat/chat.ts b/packages/examples/sdk-backend-node/chat/chat.ts index 3b594ec1c..fba19a0be 100644 --- a/packages/examples/sdk-backend-node/chat/chat.ts +++ b/packages/examples/sdk-backend-node/chat/chat.ts @@ -1,25 +1,21 @@ -import * as PushAPI from '@pushprotocol/restapi'; -import { createSocketConnection, EVENTS } from '@pushprotocol/socket'; -import { ethers } from 'ethers'; +import { PushAPI } from '@pushprotocol/restapi'; import { adjectives, animals, colors, uniqueNamesGenerator, } from 'unique-names-generator'; -import { ENV } from '../types'; import { config } from '../config'; import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; import { createWalletClient, http } from 'viem'; import { goerli } from 'viem/chains'; +import { STREAM } from '@pushprotocol/restapi/src/lib/pushstream/pushStreamTypes'; // CONFIGS const { env, showAPIResponse } = config; /***************** SAMPLE SIGNER GENERATION *********************/ -/** - * USING VIEM - */ +// Uing VIEM // Random Wallet Signers const signer = createWalletClient({ account: privateKeyToAccount(generatePrivateKey()), @@ -33,27 +29,20 @@ const secondSigner = createWalletClient({ transport: http(), }); const secondSignerAddress = secondSigner.account.address; +const thirdSigner = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const thirdSignerAddress = thirdSigner.account.address; + // Dummy Wallet Addresses const randomWallet1 = privateKeyToAccount(generatePrivateKey()).address; const randomWallet2 = privateKeyToAccount(generatePrivateKey()).address; const randomWallet3 = privateKeyToAccount(generatePrivateKey()).address; +/****************************************************************/ -/** - * USING ETHERS - */ -// // Random Wallet Signers -// const signer = ethers.Wallet.createRandom(); -// const signerAddress = signer.address; -// const secondSigner = ethers.Wallet.createRandom(); -// const secondSignerAddress = secondSigner.address; -// // Dummy Wallet Addresses -// const randomWallet1 = ethers.Wallet.createRandom().address; -// const randomWallet2 = ethers.Wallet.createRandom().address; -// const randomWallet3 = ethers.Wallet.createRandom().address; - -/************************************************************* */ - -// Group Chat Data +/***************** SAMPLE GROUP DATA ****************************/ const groupName = uniqueNamesGenerator({ dictionaries: [adjectives, colors, animals], }); @@ -62,613 +51,211 @@ const groupDescription = uniqueNamesGenerator({ }); const groupImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; - -// Push Chat - Run Chat Use cases -export const runChatUseCases = async (): Promise<void> => { - console.log(` - ██████ ██ ██ █████ ████████ - ██ ██ ██ ██ ██ ██ - ██ ███████ ███████ ██ - ██ ██ ██ ██ ██ ██ - ██████ ██ ██ ██ ██ ██ - `); - console.log('PushAPI.user.create'); - await PushAPI_user_create(); - - console.log('PushAPI.user.get'); - await PushAPI_user_get(); - - console.log('PushAPI_chat_decryptPGPKey'); - await PushAPI_chat_decryptPGPKey(); - - console.log('PushAPI.chat.chats'); - await PushAPI_chat_chats(); - - console.log('PushAPI.chat.requests'); - await PushAPI_chat_requests(); - - console.log('PushAPI.chat.send'); - const TargetChatId = await PushAPI_chat_send(); - - console.log('PushAPI.chat.approve'); - await PushAPI_chat_approve(); - - console.log('PushAPI chat Video call Notification'); - await PushAPI_chat_video_call_notification(TargetChatId); - - console.log('PushAPI.chat.createGroup'); - const { chatId, name } = await PushAPI_chat_createGroup(); - - console.log('PushAPI.chat.conversationHash'); - await PushAPI_chat_conversationHash(); - - console.log('PushAPI_chat_history'); - await PushAPI_chat_history(); - - console.log('PushAPI.chat.latest'); - await PushAPI_chat_latest(); - - console.log('PushAPI.chat.updateGroup'); - await PushAPI_chat_updateGroup(chatId); - - console.log('PushAPI.chat.getGroupByName'); - await PushAPI_chat_getGroupByName(name); - - console.log('PushAPI.chat.getGroup'); - await PushAPI_chat_getGroup(chatId); - - console.log('PushAPI.chat.decryptConversation'); - await PushAPI_chat_decryptConversation(); - - console.log('Push Chat - PushSDKSocket()'); - await PushChatSDKSocket(); -}; - -// Push Chat - PushAPI.user.create -async function PushAPI_user_create(silent = !showAPIResponse) { - const user = await PushAPI.user.create({ - signer: signer, - env: env as ENV, - }); - - const user_2 = await PushAPI.user.create({ - signer: secondSigner, - env: env as ENV, - }); - - console.log('PushAPI_user_create | Response - 200 OK'); - if (!silent) { - console.log(user); - console.log(user_2); - } - - return user; -} - -// Push Chat - PushAPI.user.get -async function PushAPI_user_get(silent = !showAPIResponse) { - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, +/***************** SAMPLE GROUP DATA ****************************/ + +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +const eventlistener = async ( + pushAPI: PushAPI, + eventName: string +): Promise<void> => { + pushAPI.stream.on(eventName, (data: any) => { + if (showAPIResponse) { + console.log('Stream Event Received'); + console.log(data); + console.log('\n'); + } }); +}; - console.log('PushAPI_user_get | Response - 200 OK'); - - if (!silent) { - console.log(user); +export const runChatClassUseCases = async (): Promise<void> => { + const userAlice = await PushAPI.initialize(signer, { env }); + const userBob = await PushAPI.initialize(secondSigner, { env }); + const userKate = await PushAPI.initialize(thirdSigner, { env }); + + // Listen stream events to receive websocket events + console.log(`Listening ${STREAM.CHAT} Events`); + eventlistener(userAlice, STREAM.CHAT); + console.log(`Listening ${STREAM.CHAT_OPS} Events`); + eventlistener(userAlice, STREAM.CHAT_OPS); + console.log('\n\n'); + + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.list'); + const aliceChats = await userAlice.chat.list('CHATS'); + const aliceRequests = await userAlice.chat.list('REQUESTS'); + if (showAPIResponse) { + console.log(aliceChats); + console.log(aliceRequests); } -} - -// Push Chat - PushAPI.chat.decryptPGPKey -async function PushAPI_chat_decryptPGPKey(silent = !showAPIResponse) { - // get user and derive encrypted PGP key - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // decrypt the PGP Key - const pgpKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - console.log('PushAPI_chat_decryptPGPKey | Response - 200 OK'); - if (!silent) { - console.log(pgpKey); + console.log('PushAPI.chat.list | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.latest'); + const aliceLatestChatWithBob = await userAlice.chat.latest( + secondSignerAddress + ); + if (showAPIResponse) { + console.log(aliceLatestChatWithBob); } -} - -// Push Chat - PushAPI.chat.chats -async function PushAPI_chat_chats(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Actual api - const response = await PushAPI.chat.chats({ - account: `eip155:${signerAddress}`, - toDecrypt: true, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_chats | Response - 200 OK'); - if (!silent) { - console.log(response); + console.log('PushAPI.chat.latest | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.history'); + const aliceChatHistoryWithBob = await userAlice.chat.history( + secondSignerAddress + ); + if (showAPIResponse) { + console.log(aliceChatHistoryWithBob); } -} - -// Push Chat - PushAPI.chat.requests -async function PushAPI_chat_requests(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Actual api - const response = await PushAPI.chat.requests({ - account: `eip155:${signerAddress}`, - toDecrypt: true, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, + console.log('PushAPI.chat.history | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.send'); + const aliceMessagesBob = await userAlice.chat.send(secondSignerAddress, { + content: 'Hello Bob!', + type: 'Text', }); - - console.log('PushAPI_chat_requests | Response - 200 OK'); - if (!silent) { - console.log(response); + if (showAPIResponse) { + console.log(aliceMessagesBob); } -} - -// Push Chat - PushAPI.chat.conversationHash -async function PushAPI_chat_conversationHash(silent = !showAPIResponse) { - // conversation hash are also called link inside chat messages - const conversationHash = await PushAPI.chat.conversationHash({ - account: `eip155:${signerAddress}`, - conversationId: `eip155:${secondSignerAddress}`, // 2nd address - env: env as ENV, - }); - - console.log('PushAPI_chat_conversationHash | Response - 200 OK'); - if (!silent) { - console.log(conversationHash); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.chat.send | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.accept'); + const bobAcceptsRequest = await userBob.chat.accept(signerAddress); + if (showAPIResponse) { + console.log(bobAcceptsRequest); } -} - -// Push Chat - PushAPI.chat.latest -async function PushAPI_chat_latest(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Fetch conversation hash - // conversation hash are also called link inside chat messages - const conversationHash = await PushAPI.chat.conversationHash({ - account: `eip155:${signerAddress}`, - conversationId: `eip155:${secondSignerAddress}`, // 2nd address - env: env as ENV, - }); - - // Actual API - const response = await PushAPI.chat.latest({ - threadhash: conversationHash.threadHash, // get conversation hash from conversationHash function and send the response threadhash here - account: `eip155:${signerAddress}`, - toDecrypt: true, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_latest | Response - 200 OK'); - if (!silent) { - console.log(response); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.chat.accept | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.reject'); + await userKate.chat.send(signerAddress, { + content: 'Sending malicious message', + type: 'Text', + }); + const AliceRejectsRequest = await userAlice.chat.reject(thirdSignerAddress); + if (showAPIResponse) { + console.log(AliceRejectsRequest); } -} - -// Push Chat - PushAPI.chat.history -async function PushAPI_chat_history(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Fetch conversation hash - // conversation hash are also called link inside chat messages - const conversationHash = await PushAPI.chat.conversationHash({ - account: `eip155:${signerAddress}`, - conversationId: `eip155:${secondSignerAddress}`, // 2nd address - env: env as ENV, - }); - - // Actual API - const response = await PushAPI.chat.history({ - threadhash: conversationHash.threadHash, // get conversation hash from conversationHash function and send the response threadhash here - account: `eip155:${signerAddress}`, - limit: 5, - toDecrypt: true, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_history | Response - 200 OK'); - if (!silent) { - console.log(response); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.chat.reject | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.block'); + const AliceBlocksBob = await userAlice.chat.block([secondSignerAddress]); + if (showAPIResponse) { + console.log(AliceBlocksBob); } -} - -// Push Chat - PushAPI.chat.send -// // Will send a message to the user or chat request in case user hasn't approved them -async function PushAPI_chat_send(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Actual api - const response = await PushAPI.chat.send({ - messageObj: { - content: "Gm gm! It's me... Mario", - }, - messageType: 'Text', // can be "Text" | "Image" | "File" | "GIF" - receiverAddress: secondSignerAddress, - - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_send | Response - 200 OK'); - if (!silent) { - console.log(response); + console.log('PushAPI.chat.block | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.chat.unblock'); + const AliceUnblocksBob = await userAlice.chat.unblock([secondSignerAddress]); + if (showAPIResponse) { + console.log(AliceUnblocksBob); } - return response.chatId; -} - -// Push Chat - Approve -async function PushAPI_chat_approve(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${secondSignerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: secondSigner, - }); - - // Actual api - const approve = await PushAPI.chat.approve({ - status: 'Approved', - senderAddress: signerAddress, // receiver's address or chatId of a group - - signer: secondSigner, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_approve | Response - 200 OK'); - if (!silent) { - console.log(approve); + console.log('PushAPI.chat.unblock | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.create'); + const createdGroup = await userAlice.chat.group.create(groupName, { + description: groupDescription, + image: groupImage, + members: [randomWallet1, randomWallet2], + admins: [], + private: false, + }); + const groupChatId = createdGroup.chatId; // to be used in other examples + if (showAPIResponse) { + console.log(createdGroup); } -} - -// Push Chat - PushAPI.chat.createGroup -async function PushAPI_chat_createGroup( - silent = !showAPIResponse -): Promise<{ chatId: string; name: string }> { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Actual API - // Convert image to base 64 and pass - const response = await PushAPI.chat.createGroup({ - groupName, - groupDescription, - members: [`eip155:${randomWallet1}`, `eip155:${randomWallet2}`], - groupImage, - admins: [], // takes signer as admin automatically, add more if you want to - isPublic: true, - - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_createGroup | Response - 200 OK'); - if (!silent) { - console.log(response); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.create | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.permissions'); + const grouppermissions = await userAlice.chat.group.permissions(groupChatId); + if (showAPIResponse) { + console.log(grouppermissions); } - return { chatId: response.chatId, name: response.groupName }; -} - -// Push Chat - PushAPI.chat.updateGroup -async function PushAPI_chat_updateGroup( - chatId: string, - silent = !showAPIResponse -) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Actual API - // Convert image to base 64 and pass - // This is an idempotent operation, meaning it requires all group info to be passed no matter if only few things change - // Why so? To ensure that verificationProof always is able to replicate the current group info (trustless since signature is stored with the info) - const response = await PushAPI.chat.updateGroup({ - chatId, - groupName, - groupDescription, - members: [ - `eip155:${randomWallet1}`, - `eip155:${randomWallet2}`, - `eip155:${randomWallet3}`, - `eip155:${signerAddress}`, - ], - groupImage, - admins: [`eip155:${signerAddress}`], // takes signer as admin automatically, add more if you want to - - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - console.log('PushAPI_chat_updateGroup | Response - 200 OK'); - if (!silent) { - console.log(response); + console.log('PushAPI.group.permissions | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.info'); + const groupInfo = await userAlice.chat.group.info(groupChatId); + if (showAPIResponse) { + console.log(groupInfo); } -} - -// Push Chat - PushAPI.chat.getGroupByName -async function PushAPI_chat_getGroupByName( - name: string, - silent = !showAPIResponse -) { - const response = await PushAPI.chat.getGroupByName({ - groupName: name, - env: env as ENV, - }); - - console.log('PushAPI_chat_getGroupByName | Response - 200 OK'); - if (!silent) { - console.log(response); + console.log('PushAPI.group.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.update'); + const updatedGroup = await userAlice.chat.group.update(groupChatId, { + description: 'Updated Description', + }); + if (showAPIResponse) { + console.log(updatedGroup); } -} - -// Push Chat - PushAPI.chat.getGroup -async function PushAPI_chat_getGroup( - chatId: string, - silent = !showAPIResponse -) { - const response = await PushAPI.chat.getGroup({ - chatId: chatId, - env: env as ENV, - }); - - console.log('PushAPI_chat_getGroup | Response - 200 OK'); - if (!silent) { - console.log(response); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.update | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.add'); + const addMember = await userAlice.chat.group.add(groupChatId, { + role: 'MEMBER', + accounts: [randomWallet3], + }); + if (showAPIResponse) { + console.log(addMember); } -} - -// Push Chat - PushAPI.chat.decryptConversation -async function PushAPI_chat_decryptConversation(silent = !showAPIResponse) { - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${signerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: signer, - }); - - // Fetch conversation hash - // conversation hash are also called link inside chat messages - const conversationHash = await PushAPI.chat.conversationHash({ - account: `eip155:${signerAddress}`, - conversationId: `eip155:${secondSignerAddress}`, // 2nd address - env: env as ENV, - }); - - // Chat History - const encryptedChats = await PushAPI.chat.history({ - threadhash: conversationHash.threadHash, // get conversation hash from conversationHash function and send the response threadhash here - account: `eip155:${signerAddress}`, - limit: 5, - toDecrypt: false, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - - // Decrypted Chat - const decryptedChat = await PushAPI.chat.decryptConversation({ - messages: encryptedChats, // array of message object fetched from chat.history method - connectedUser: user, // user meta data object fetched from chat.get method - pgpPrivateKey: pgpDecrpyptedPvtKey, //decrypted private key - env: env as ENV, - }); - - console.log('PushAPI_chat_decryptConversation | Response - 200 OK'); - if (!silent) { - console.log(decryptedChat); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.add | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.remove'); + const removeMember = await userAlice.chat.group.remove(groupChatId, { + role: 'MEMBER', + accounts: [randomWallet3], + }); + if (showAPIResponse) { + console.log(removeMember); } -} - -// Push Chat - Socket Connection -async function PushChatSDKSocket(silent = !showAPIResponse) { - const pushSDKSocket = createSocketConnection({ - user: `eip155:${signerAddress}`, - socketType: 'chat', - socketOptions: { autoConnect: true, reconnectionAttempts: 3 }, - env: env as ENV, - }); - - if (!pushSDKSocket) { - throw new Error('Socket not connected'); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.remove | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.join'); + const joinGrp = await userBob.chat.group.join(groupChatId); + if (showAPIResponse) { + console.log(joinGrp); } - - pushSDKSocket.on(EVENTS.CONNECT, async () => { - console.log('Socket Connected - will disconnect after 4 seconds'); - - // send a chat from other wallet to this one to see the result - // Fetch user - const user = await PushAPI.user.get({ - account: `eip155:${secondSignerAddress}`, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - - signer: secondSigner, - }); - - // Actual api - const response = await PushAPI.chat.send({ - messageContent: "Gm gm! It's me... Mario", - messageType: 'Text', - receiverAddress: `eip155:${signerAddress}`, - - signer: secondSigner, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, - }); - console.log('PushAPI_chat_send | Response - 200 OK'); - }); - - pushSDKSocket.on(EVENTS.DISCONNECT, () => { - console.log('Socket Disconnected'); - }); - - pushSDKSocket.on(EVENTS.CHAT_RECEIVED_MESSAGE, (message) => { - // feedItem is the notification data when that notification was received - console.log('Incoming Push Chat message from Socket'); - if (!silent) { - console.log(message); - } - - // disconnect socket after this, not to be done in real implementations - pushSDKSocket.disconnect(); - }); - - const delay = (ms: number) => - new Promise((resolve) => setTimeout(resolve, ms)); - await delay(4000); -} - -async function PushAPI_chat_video_call_notification( - chatId: string, - silent = !showAPIResponse -) { - // Fetch user - const user = await PushAPI.user.get({ - account: signerAddress, - env: env as ENV, - }); - - // Decrypt PGP Key - const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - signer: signer, - }); - // get PGP KEy - const apiResponse = await PushAPI.payloads.sendNotification({ - senderType: 1, - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - chatId: chatId, - type: 3, // target - identityType: 2, // direct payload - notification: { - title: `VC TITLE:`, - body: `VC BODY`, - }, - payload: { - title: `payload title`, - body: `sample msg body`, - cta: '', - img: '', - additionalMeta: { - type: '1+1', - data: 'Random DATA', - domain: 'push.org', - }, - }, - recipients: secondSignerAddress, // recipient address - channel: signerAddress, // your channel address - env: env as ENV, - }); - - console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); - if (!silent) { - console.log(apiResponse); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.join | Response - 200 OK\n\n'); + //------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.leave'); + const leaveGrp = await userBob.chat.group.leave(groupChatId); + if (showAPIResponse) { + console.log(leaveGrp); } -} + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.leave | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.group.reject'); + const sampleGrp = await userAlice.chat.group.create('Sample Grp', { + description: groupDescription, + image: groupImage, + members: [secondSignerAddress], // invite bob + admins: [], + private: true, + }); + await userBob.chat.group.reject(sampleGrp.chatId); + await delay(2000); // Delay added to log the events in order + console.log('PushAPI.group.reject | Response - 200 OK\n\n'); +}; diff --git a/packages/examples/sdk-backend-node/chat/index.ts b/packages/examples/sdk-backend-node/chat/index.ts index 40bccd361..85621540f 100644 --- a/packages/examples/sdk-backend-node/chat/index.ts +++ b/packages/examples/sdk-backend-node/chat/index.ts @@ -1,2 +1,28 @@ -export { runChatUseCases } from './chat'; -export { runNFTChatUseCases } from './nftChat'; +import { runChatLowlevelUseCases } from './chat.lowlevel'; +import { runNFTChatLowLevelUseCases } from './nftChat.lowlevel'; +import { runChatClassUseCases } from './chat'; + +export const runChatUseCases = async (): Promise<void> => { + console.log(` +░█████╗░██╗░░██╗░█████╗░████████╗ +██╔══██╗██║░░██║██╔══██╗╚══██╔══╝ +██║░░╚═╝███████║███████║░░░██║░░░ +██║░░██╗██╔══██║██╔══██║░░░██║░░░ +╚█████╔╝██║░░██║██║░░██║░░░██║░░░ +░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░ + `); + + await runChatClassUseCases(); + console.log(` +▒█▀▀█ ▒█░▒█ ░█▀▀█ ▀▀█▀▀ ░ ▒█░░░ ▒█▀▀▀█ ▒█░░▒█ ▒█░░░ ▒█▀▀▀ ▒█░░▒█ ▒█▀▀▀ ▒█░░░ +▒█░░░ ▒█▀▀█ ▒█▄▄█ ░▒█░░ ▄ ▒█░░░ ▒█░░▒█ ▒█▒█▒█ ▒█░░░ ▒█▀▀▀ ░▒█▒█░ ▒█▀▀▀ ▒█░░░ +▒█▄▄█ ▒█░▒█ ▒█░▒█ ░▒█░░ █ ▒█▄▄█ ▒█▄▄▄█ ▒█▄▀▄█ ▒█▄▄█ ▒█▄▄▄ ░░▀▄▀░ ▒█▄▄▄ ▒█▄▄█ + `); + await runChatLowlevelUseCases(); + console.log(` +▒█▄░▒█ ▒█▀▀▀ ▀▀█▀▀ ▒█▀▀█ ▒█░▒█ ░█▀▀█ ▀▀█▀▀ ░ ▒█░░░ ▒█▀▀▀█ ▒█░░▒█ ▒█░░░ ▒█▀▀▀ ▒█░░▒█ ▒█▀▀▀ ▒█░░░ +▒█▒█▒█ ▒█▀▀▀ ░▒█░░ ▒█░░░ ▒█▀▀█ ▒█▄▄█ ░▒█░░ ▄ ▒█░░░ ▒█░░▒█ ▒█▒█▒█ ▒█░░░ ▒█▀▀▀ ░▒█▒█░ ▒█▀▀▀ ▒█░░░ +▒█░░▀█ ▒█░░░ ░▒█░░ ▒█▄▄█ ▒█░▒█ ▒█░▒█ ░▒█░░ █ ▒█▄▄█ ▒█▄▄▄█ ▒█▄▀▄█ ▒█▄▄█ ▒█▄▄▄ ░░▀▄▀░ ▒█▄▄▄ ▒█▄▄█ + `); + await runNFTChatLowLevelUseCases(); +}; diff --git a/packages/examples/sdk-backend-node/chat/nftChat.ts b/packages/examples/sdk-backend-node/chat/nftChat.lowlevel.ts similarity index 96% rename from packages/examples/sdk-backend-node/chat/nftChat.ts rename to packages/examples/sdk-backend-node/chat/nftChat.lowlevel.ts index b238022be..2f5142d5c 100644 --- a/packages/examples/sdk-backend-node/chat/nftChat.ts +++ b/packages/examples/sdk-backend-node/chat/nftChat.lowlevel.ts @@ -74,15 +74,7 @@ const skipExample = () => { }; // Push Chat - Run Chat Use cases -export const runNFTChatUseCases = async (): Promise<void> => { - console.log(` - ███ ██ ███████ ████████ ██████ ██ ██ █████ ████████ - ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██ █████ ██ ██ ███████ ███████ ██ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ████ ██ ██ ██████ ██ ██ ██ ██ ██ - `); - +export const runNFTChatLowLevelUseCases = async (): Promise<void> => { if (skipExample()) { console.log('Skipping examples as required env vars are missing'); return; @@ -526,9 +518,9 @@ async function PushAPI_nft_chat_updateGroup( chatId, groupName: updatedNftGroupName, groupDescription, - members: [nftAccount2, nftAccount3], + members: [nftAccount2, nftAccount3, nftAccount1], groupImage, - admins: [nftAccount2], + admins: [nftAccount1], account: nftAccount1, signer: nftSigner1, pgpPrivateKey: pgpDecrpyptedPvtKey, diff --git a/packages/examples/sdk-backend-node/main.ts b/packages/examples/sdk-backend-node/main.ts index dbb09f210..e8a538268 100644 --- a/packages/examples/sdk-backend-node/main.ts +++ b/packages/examples/sdk-backend-node/main.ts @@ -1,11 +1,12 @@ -import { runNotificaitonsUseCases } from './notification'; -import { runChatUseCases, runNFTChatUseCases } from './chat'; +import { runUserCases } from './user'; +import { runNotificationUseCases } from './notification'; +import { runChatUseCases } from './chat'; import { runVideoUseCases } from './video'; -import { runSpacesUseCases } from './spaces'; -import { runPushAPICases } from './pushAPI'; +import { runSpaceUseCases } from './space'; import { config } from './config'; import { ENV } from './types'; +import { exit } from 'process'; // CONFIGS const { env } = config; @@ -15,12 +16,12 @@ const start = async (): Promise<void> => { console.log(`${returnHeadingLog()}`); console.log(`${returnENVLog()}`); - await runPushAPICases(); - await runNotificaitonsUseCases(); + await runUserCases(); + await runNotificationUseCases(); await runChatUseCases(); - await runNFTChatUseCases(); await runVideoUseCases(); - await runSpacesUseCases(); + await runSpaceUseCases(); + exit(0); }; start(); @@ -32,39 +33,54 @@ start(); // ----------- function returnHeadingLog() { const headingLog = ` - ███████ ██████ ██ ██ ███████ ██ ██ ███ ██ ██████ ████████ ██ ██████ ███ ██ █████ ██ ██ ████████ ██ ██ - ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ - ███████ ██ ██ █████ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ███████ ██████ ██ ██ ██ ██████ ██ ████ ██████ ██ ██ ██████ ██ ████ ██ ██ ███████ ██ ██ ██ + +░██████╗██████╗░██╗░░██╗ ███████╗██╗░░░██╗███╗░░██╗░█████╗░████████╗██╗░█████╗░███╗░░██╗░█████╗░██╗░░░░░██╗████████╗██╗░░░██╗ +██╔════╝██╔══██╗██║░██╔╝ ██╔════╝██║░░░██║████╗░██║██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║██╔══██╗██║░░░░░██║╚══██╔══╝╚██╗░██╔╝ +╚█████╗░██║░░██║█████═╝░ █████╗░░██║░░░██║██╔██╗██║██║░░╚═╝░░░██║░░░██║██║░░██║██╔██╗██║███████║██║░░░░░██║░░░██║░░░░╚████╔╝░ +░╚═══██╗██║░░██║██╔═██╗░ ██╔══╝░░██║░░░██║██║╚████║██║░░██╗░░░██║░░░██║██║░░██║██║╚████║██╔══██║██║░░░░░██║░░░██║░░░░░╚██╔╝░░ +██████╔╝██████╔╝██║░╚██╗ ██║░░░░░╚██████╔╝██║░╚███║╚█████╔╝░░░██║░░░██║╚█████╔╝██║░╚███║██║░░██║███████╗██║░░░██║░░░░░░██║░░░ +╚═════╝░╚═════╝░╚═╝░░╚═╝ ╚═╝░░░░░░╚═════╝░╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝╚═╝░░╚═╝╚══════╝╚═╝░░░╚═╝░░░░░░╚═╝░░░ `; return headingLog; } function returnENVLog() { let environmentLog = ` - ███████ ████████ █████ ██████ ██ ███ ██ ██████ - ██ ██ ██ ██ ██ ██ ████ ██ ██ - ███████ ██ ███████ ██ ███ ██ ██ ██ ██ ██ ███ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ███████ ██ ██ ██ ██████ ██ ██ ████ ██████ + +███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ░██████╗████████╗░█████╗░░██████╗░██╗███╗░░██╗░██████╗░ +██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██╔════╝╚══██╔══╝██╔══██╗██╔════╝░██║████╗░██║██╔════╝░ +█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ╚█████╗░░░░██║░░░███████║██║░░██╗░██║██╔██╗██║██║░░██╗░ +██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ░╚═══██╗░░░██║░░░██╔══██║██║░░╚██╗██║██║╚████║██║░░╚██╗ +███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ██████╔╝░░░██║░░░██║░░██║╚██████╔╝██║██║░╚███║╚██████╔╝ +╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░╚═════╝░╚═╝╚═╝░░╚══╝░╚═════╝░ `; if (env === ENV.PROD) { environmentLog = ` - ██████ ██████ ██████ ██████ ██ ██ ██████ ████████ ██ ██████ ███ ██ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ - ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██ ██████ ██████ ██████ ██████ ██ ██ ██████ ██ ████ +███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ██████╗░██████╗░░█████╗░██████╗░ +██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██╔══██╗██╔══██╗██╔══██╗██╔══██╗ +█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ██████╔╝██████╔╝██║░░██║██║░░██║ +██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ██╔═══╝░██╔══██╗██║░░██║██║░░██║ +███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ██║░░░░░██║░░██║╚█████╔╝██████╔╝ +╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚═╝░░░░░╚═╝░░╚═╝░╚════╝░╚═════╝░ `; } else if (env === ENV.DEV) { environmentLog = ` - ██████ ███████ ██ ██ - ██ ██ ██ ██ ██ - ██ ██ █████ ██ ██ - ██ ██ ██ ██ ██ - ██████ ███████ ████ +███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ██████╗░███████╗██╗░░░██╗ +██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██╔══██╗██╔════╝██║░░░██║ +█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ██║░░██║█████╗░░╚██╗░██╔╝ +██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ██║░░██║██╔══╝░░░╚████╔╝░ +███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ██████╔╝███████╗░░╚██╔╝░░ +╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚═════╝░╚══════╝░░░╚═╝░░░ + `; + } else if (env === ENV.LOCAL) { + environmentLog = ` +███████╗███╗░░██╗██╗░░░██╗ ░░░░░░ ██╗░░░░░░█████╗░░█████╗░░█████╗░██╗░░░░░ +██╔════╝████╗░██║██║░░░██║ ░░░░░░ ██║░░░░░██╔══██╗██╔══██╗██╔══██╗██║░░░░░ +█████╗░░██╔██╗██║╚██╗░██╔╝ █████╗ ██║░░░░░██║░░██║██║░░╚═╝███████║██║░░░░░ +██╔══╝░░██║╚████║░╚████╔╝░ ╚════╝ ██║░░░░░██║░░██║██║░░██╗██╔══██║██║░░░░░ +███████╗██║░╚███║░░╚██╔╝░░ ░░░░░░ ███████╗╚█████╔╝╚█████╔╝██║░░██║███████╗ +╚══════╝╚═╝░░╚══╝░░░╚═╝░░░ ░░░░░░ ╚══════╝░╚════╝░░╚════╝░╚═╝░░╚═╝╚══════╝ `; } diff --git a/packages/examples/sdk-backend-node/notification/index.ts b/packages/examples/sdk-backend-node/notification/index.ts index 605a60a23..f2251c1c7 100644 --- a/packages/examples/sdk-backend-node/notification/index.ts +++ b/packages/examples/sdk-backend-node/notification/index.ts @@ -1,384 +1,20 @@ -import * as PushAPI from '@pushprotocol/restapi'; -import { createSocketConnection, EVENTS } from '@pushprotocol/socket'; -import { ethers } from 'ethers'; -import { config } from '../config'; +import { runNotificaitonsLowLevelUseCases } from './notification.lowlevel'; +import { runNotificationClassUseCases } from './notification'; -import { createWalletClient, http } from 'viem'; -import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; -import { goerli } from 'viem/chains'; - -enum ENV { - PROD = 'prod', - STAGING = 'staging', - DEV = 'dev', - /** - * **This is for local development only** - */ - LOCAL = 'local', -} - -// CONFIGS -const { env, showAPIResponse } = config; - -// If you own a channel, you can use your channel address as well -const channelPrivateKey = process.env.WALLET_PRIVATE_KEY; - -/***************** SAMPLE SIGNER GENERATION *********************/ -/** - * USING VIEM - */ -const signerChannel = channelPrivateKey - ? createWalletClient({ - account: privateKeyToAccount(`0x${channelPrivateKey}`), - chain: goerli, - transport: http(), - }) - : undefined; -const channelAddress = signerChannel - ? signerChannel.account.address - : undefined; -// Random Wallet Signers -const signer = createWalletClient({ - account: privateKeyToAccount(generatePrivateKey()), - chain: goerli, - transport: http(), -}); -const signerAddress = signer.account.address; -// Dummy Wallet Addresses -const randomWallet1 = privateKeyToAccount(generatePrivateKey()).address; - -/** - * USING ETHERS - */ -// const signerChannel = new ethers.Wallet(`0x${channelPrivateKey}`); -// const channelAddress = signerChannel.address; -// // Random Wallet Signers -// const signer = ethers.Wallet.createRandom(); -// const signerAddress = signer.address; -// // Dummy Wallet Addresses -// const randomWallet1 = ethers.Wallet.createRandom().address; -/************************************************************* */ - -const skipExample = () => { - const requiredEnvVars = ['WALLET_PRIVATE_KEY']; - - for (const envVar of requiredEnvVars) { - if (!process.env[envVar]) { - return true; // Skip the example if any of the required env vars is missing - } - } - - return false; // All required env vars are present, don't skip the example -}; - -// Push Notification - Run Notifications Use cases -export const runNotificaitonsUseCases = async (): Promise<void> => { +export const runNotificationUseCases = async (): Promise<void> => { + console.log(` +███╗░░██╗░█████╗░████████╗██╗███████╗██╗░█████╗░░█████╗░████████╗██╗░█████╗░███╗░░██╗ +████╗░██║██╔══██╗╚══██╔══╝██║██╔════╝██║██╔══██╗██╔══██╗╚══██╔══╝██║██╔══██╗████╗░██║ +██╔██╗██║██║░░██║░░░██║░░░██║█████╗░░██║██║░░╚═╝███████║░░░██║░░░██║██║░░██║██╔██╗██║ +██║╚████║██║░░██║░░░██║░░░██║██╔══╝░░██║██║░░██╗██╔══██║░░░██║░░░██║██║░░██║██║╚████║ +██║░╚███║╚█████╔╝░░░██║░░░██║██║░░░░░██║╚█████╔╝██║░░██║░░░██║░░░██║╚█████╔╝██║░╚███║ +╚═╝░░╚══╝░╚════╝░░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░╚════╝░╚═╝░░╚══╝ + `); + await runNotificationClassUseCases(); console.log(` - ███ ██ ██████ ████████ ██ ███████ ██ ██████ █████ ████████ ██ ██████ ███ ██ ███████ - ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ - ██ ██ ██ ██ ██ ██ ██ █████ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ███████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ████ ██████ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██████ ██ ████ ███████ +▒█▄░▒█ ▒█▀▀▀█ ▀▀█▀▀ ▀█▀ ▒█▀▀▀ ▀█▀ ▒█▀▀█ ░█▀▀█ ▀▀█▀▀ ▀█▀ ▒█▀▀▀█ ▒█▄░▒█ ░ ▒█░░░ ▒█▀▀▀█ ▒█░░▒█ ▒█░░░ ▒█▀▀▀ ▒█░░▒█ ▒█▀▀▀ ▒█░░░ +▒█▒█▒█ ▒█░░▒█ ░▒█░░ ▒█░ ▒█▀▀▀ ▒█░ ▒█░░░ ▒█▄▄█ ░▒█░░ ▒█░ ▒█░░▒█ ▒█▒█▒█ ▄ ▒█░░░ ▒█░░▒█ ▒█▒█▒█ ▒█░░░ ▒█▀▀▀ ░▒█▒█░ ▒█▀▀▀ ▒█░░░ +▒█░░▀█ ▒█▄▄▄█ ░▒█░░ ▄█▄ ▒█░░░ ▄█▄ ▒█▄▄█ ▒█░▒█ ░▒█░░ ▄█▄ ▒█▄▄▄█ ▒█░░▀█ █ ▒█▄▄█ ▒█▄▄▄█ ▒█▄▀▄█ ▒█▄▄█ ▒█▄▄▄ ░░▀▄▀░ ▒█▄▄▄ ▒█▄▄█ `); - console.log('PushAPI.user.getFeeds'); - await PushAPI_user_getFeeds(); - - console.log('PushAPI.user.getFeeds [Spam]'); - await PushAPI_user_getFeeds__spam(); - - console.log('PushAPI.user.getSubscriptions'); - await PushAPI_user_getSubscriptions(); - - if (!skipExample()) { - console.log('PushAPI.channels.getChannel()'); - await PushAPI_channels_getChannel(); - - console.log('PushAPI.channels.search()'); - await PushAPI_channels_search(); - - console.log('PushAPI.channels.subscribe()'); - await PushAPI_channels_subscribe(); - - console.log('PushAPI.channels.unsubscribe()'); - await PushAPI_channels_unsubscribe(); - - // IMPORTANT: VARIOUS OTHER NOTIFICATIONS FORMAT SUPPORTED - // EXAMPLES HERE: https://github.com/ethereum-push-notification-service/push-sdk/blob/main/packages/restapi/README.md - console.log( - 'PushAPI.payloads.sendNotification() [Direct Payload, Single Recipient]' - ); - await PushAPI_payloads_sendNotification__direct_payload_single_recipient(); - - console.log( - 'PushAPI.payloads.sendNotification() [Direct Payload, Batch of Recipients (Subset)]' - ); - await PushAPI_payloads_sendNotification__direct_payload_group_of_recipient_subset(); - - console.log( - 'PushAPI.payloads.sendNotification() [Direct Payload, All Recipients (Broadcast)]' - ); - await PushAPI_payloads_sendNotification__direct_payload_all_recipients_brodcast(); - - console.log('PushAPI.channels._getSubscribers()'); - await PushAPI_channels_getSubscribers(); - - console.log('Push Notification - PushSDKSocket()'); - await PushSDKSocket(); - } + await runNotificaitonsLowLevelUseCases(); }; - -// Push Notification - PushAPI.user.getFeeds -async function PushAPI_user_getFeeds(silent = !showAPIResponse) { - const notifications = await PushAPI.user.getFeeds({ - user: `eip155:5:${signerAddress}`, // user address in CAIP - env: env as ENV, - }); - - console.log('PushAPI.user.getFeeds | Response - 200 OK'); - if (!silent) { - console.log(notifications); - } -} - -// Push Notification - PushAPI.user.getFeeds - Spam -async function PushAPI_user_getFeeds__spam(silent = !showAPIResponse) { - const notifications = await PushAPI.user.getFeeds({ - user: `eip155:5:${signerAddress}`, // user address in CAIP - spam: true, - env: env as ENV, - }); - - console.log('PushAPI.user.getFeeds [Spam] | Response - 200 OK'); - if (!silent) { - console.log(notifications); - } -} - -// Push Notification - PushAPI.user.getSubscriptions -async function PushAPI_user_getSubscriptions(silent = !showAPIResponse) { - const subscriptions = await PushAPI.user.getSubscriptions({ - user: `eip155:5:${signerAddress}`, // user address in CAIP - env: env as ENV, - }); - - console.log('PushAPI.user.getSubscriptions | Response - 200 OK'); - if (!silent) { - console.log(subscriptions); - } -} - -// Push Notification - PushAPI.channels.getChannel -async function PushAPI_channels_getChannel(silent = !showAPIResponse) { - const channelData = await PushAPI.channels.getChannel({ - channel: channelAddress as string, - env: env as ENV, - }); - - console.log('PushAPI.channels.getChannel | Response - 200 OK'); - if (!silent) { - console.log(channelData); - } -} - -// Push Notification - PushAPI.channels.search -async function PushAPI_channels_search(silent = !showAPIResponse) { - const channelsData = await PushAPI.channels.search({ - query: 'push', // a search query - page: 1, // page index - limit: 20, // no of items per page - env: env as ENV, - }); - - console.log('PushAPI.channels.search | Response - 200 OK'); - if (!silent) { - console.log(channelsData); - } -} - -// Push Notification - PushAPI.channels.subscribe -async function PushAPI_channels_subscribe(silent = !showAPIResponse) { - const response = await PushAPI.channels.subscribe({ - signer: signer, - channelAddress: `eip155:5:${channelAddress}`, // channel address in CAIP - userAddress: `eip155:5:${signerAddress}`, // user address in CAIP - onSuccess: () => { - console.log('opt in success'); - }, - onError: () => { - console.error('opt in error'); - }, - env: env as ENV, - }); - - console.log('PushAPI.channels.subscribe | Response - 200 OK'); - if (!silent) { - console.log(response); - } -} - -// Push Notification - PushAPI.channels.unsubscribe -async function PushAPI_channels_unsubscribe(silent = !showAPIResponse) { - const response = await PushAPI.channels.unsubscribe({ - signer: signer, - channelAddress: `eip155:5:${channelAddress}`, // channel address in CAIP - userAddress: `eip155:5:${signerAddress}`, // user address in CAIP - onSuccess: () => { - console.log('opt out success'); - }, - onError: () => { - console.error('opt out error'); - }, - env: env as ENV, - }); - - console.log('PushAPI.channels.unsubscribe | Response - 200 OK'); - if (!silent) { - console.log(response); - } -} - -// Push Notification - Send Notifications -// Direct payload for single recipient(target) -// PushAPI.payloads.sendNotification -async function PushAPI_payloads_sendNotification__direct_payload_single_recipient( - silent = !showAPIResponse -) { - const apiResponse = await PushAPI.payloads.sendNotification({ - signer: signerChannel, // Need to resolve to channel address - type: 3, // target - identityType: 2, // direct payload - notification: { - title: `notification TITLE:`, - body: `notification BODY`, - }, - payload: { - title: `payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - recipients: `eip155:5:${signerAddress}`, // recipient address - channel: `eip155:5:${channelAddress}`, // your channel address - env: env as ENV, - }); - - console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); - if (!silent) { - console.log(apiResponse); - } -} - -// Push Notification - Direct payload for group of recipients(subset) -// PushAPI.payloads.sendNotification -async function PushAPI_payloads_sendNotification__direct_payload_group_of_recipient_subset( - silent = !showAPIResponse -) { - const apiResponse = await PushAPI.payloads.sendNotification({ - signer: signerChannel, // Need to resolve to channel address - type: 4, // subset - identityType: 2, // direct payload - notification: { - title: `notification TITLE:`, - body: `notification BODY`, - }, - payload: { - title: `payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - recipients: [`eip155:5:${signerAddress}`, `eip155:5:${randomWallet1}`], // recipient addresses - channel: `eip155:5:${channelAddress}`, // your channel address - env: env as ENV, - }); - - console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); - if (!silent) { - console.log(apiResponse); - } -} - -// Push Notification - Direct payload for all recipients(broadcast) -// PushAPI.payloads.sendNotification -async function PushAPI_payloads_sendNotification__direct_payload_all_recipients_brodcast( - silent = !showAPIResponse -) { - const apiResponse = await PushAPI.payloads.sendNotification({ - signer: signerChannel, // Needs to resolve to channel address - type: 1, // broadcast - identityType: 2, // direct payload - notification: { - title: `notification TITLE:`, - body: `notification BODY`, - }, - payload: { - title: `payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - channel: `eip155:5:${channelAddress}`, // your channel address - env: env as ENV, - }); - - console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); - if (!silent) { - console.log(apiResponse); - } -} - -// Push Notification - Get Subscribers list from channels (DEPRECATED) -async function PushAPI_channels_getSubscribers(silent = !showAPIResponse) { - const subscribers = await PushAPI.channels._getSubscribers({ - channel: `eip155:5:${channelAddress}`, // channel address in CAIP - env: env as ENV, - }); - - console.log('PushAPI.channels._getSubscribers | Response - 200 OK'); - if (!silent) { - console.log(subscribers); - } -} - -// Push Notification - Socket Connection -async function PushSDKSocket(silent = !showAPIResponse) { - const pushSDKSocket = createSocketConnection({ - user: `eip155:5:${signerAddress}`, // CAIP, see below - socketOptions: { autoConnect: false }, - env: env as ENV, - }); - - if (!pushSDKSocket) { - throw new Error('PushSDKSocket | Socket Connection Failed'); - } - - pushSDKSocket.connect(); - - pushSDKSocket.on(EVENTS.CONNECT, async () => { - console.log('Socket Connected - will disconnect after 4 seconds'); - - // send a notification to see the result - await PushAPI_payloads_sendNotification__direct_payload_single_recipient( - true - ); - }); - - pushSDKSocket.on(EVENTS.DISCONNECT, () => { - console.log('Socket Disconnected'); - }); - - pushSDKSocket.on(EVENTS.USER_FEEDS, (feedItem) => { - // feedItem is the notification data when that notification was received - console.log('Incoming Feed from Socket'); - if (!silent) { - console.log(feedItem); - } - - // disconnect socket after this, not to be done in real implementations - pushSDKSocket.disconnect(); - }); - - const delay = (ms: number) => - new Promise((resolve) => setTimeout(resolve, ms)); - await delay(4000); -} diff --git a/packages/examples/sdk-backend-node/notification/notification.lowlevel.ts b/packages/examples/sdk-backend-node/notification/notification.lowlevel.ts new file mode 100644 index 000000000..e2f04f99a --- /dev/null +++ b/packages/examples/sdk-backend-node/notification/notification.lowlevel.ts @@ -0,0 +1,377 @@ +import * as PushAPI from '@pushprotocol/restapi'; +import { createSocketConnection, EVENTS } from '@pushprotocol/socket'; +import { ethers } from 'ethers'; +import { config } from '../config'; + +import { createWalletClient, http } from 'viem'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { goerli } from 'viem/chains'; + +enum ENV { + PROD = 'prod', + STAGING = 'staging', + DEV = 'dev', + /** + * **This is for local development only** + */ + LOCAL = 'local', +} + +// CONFIGS +const { env, showAPIResponse } = config; + +// If you own a channel, you can use your channel address as well +const channelPrivateKey = process.env.WALLET_PRIVATE_KEY; + +/***************** SAMPLE SIGNER GENERATION *********************/ +/** + * USING VIEM + */ +const signerChannel = channelPrivateKey + ? createWalletClient({ + account: privateKeyToAccount(`0x${channelPrivateKey}`), + chain: goerli, + transport: http(), + }) + : undefined; +const channelAddress = signerChannel + ? signerChannel.account.address + : undefined; +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const signerAddress = signer.account.address; +// Dummy Wallet Addresses +const randomWallet1 = privateKeyToAccount(generatePrivateKey()).address; + +/** + * USING ETHERS + */ +// const signerChannel = new ethers.Wallet(`0x${channelPrivateKey}`); +// const channelAddress = signerChannel.address; +// // Random Wallet Signers +// const signer = ethers.Wallet.createRandom(); +// const signerAddress = signer.address; +// // Dummy Wallet Addresses +// const randomWallet1 = ethers.Wallet.createRandom().address; +/************************************************************* */ + +const skipExample = () => { + const requiredEnvVars = ['WALLET_PRIVATE_KEY']; + + for (const envVar of requiredEnvVars) { + if (!process.env[envVar]) { + return true; // Skip the example if any of the required env vars is missing + } + } + + return false; // All required env vars are present, don't skip the example +}; + +// Push Notification - Run Notifications Use cases +export const runNotificaitonsLowLevelUseCases = async (): Promise<void> => { + console.log('PushAPI.user.getFeeds'); + await PushAPI_user_getFeeds(); + + console.log('PushAPI.user.getFeeds [Spam]'); + await PushAPI_user_getFeeds__spam(); + + console.log('PushAPI.user.getSubscriptions'); + await PushAPI_user_getSubscriptions(); + + if (!skipExample()) { + console.log('PushAPI.channels.getChannel()'); + await PushAPI_channels_getChannel(); + + console.log('PushAPI.channels.search()'); + await PushAPI_channels_search(); + + console.log('PushAPI.channels.subscribe()'); + await PushAPI_channels_subscribe(); + + console.log('PushAPI.channels.unsubscribe()'); + await PushAPI_channels_unsubscribe(); + + // IMPORTANT: VARIOUS OTHER NOTIFICATIONS FORMAT SUPPORTED + // EXAMPLES HERE: https://github.com/ethereum-push-notification-service/push-sdk/blob/main/packages/restapi/README.md + console.log( + 'PushAPI.payloads.sendNotification() [Direct Payload, Single Recipient]' + ); + await PushAPI_payloads_sendNotification__direct_payload_single_recipient(); + + console.log( + 'PushAPI.payloads.sendNotification() [Direct Payload, Batch of Recipients (Subset)]' + ); + await PushAPI_payloads_sendNotification__direct_payload_group_of_recipient_subset(); + + console.log( + 'PushAPI.payloads.sendNotification() [Direct Payload, All Recipients (Broadcast)]' + ); + await PushAPI_payloads_sendNotification__direct_payload_all_recipients_brodcast(); + + console.log('PushAPI.channels._getSubscribers()'); + await PushAPI_channels_getSubscribers(); + + console.log('Push Notification - PushSDKSocket()'); + await PushSDKSocket(); + } +}; + +// Push Notification - PushAPI.user.getFeeds +async function PushAPI_user_getFeeds(silent = !showAPIResponse) { + const notifications = await PushAPI.user.getFeeds({ + user: `eip155:5:${signerAddress}`, // user address in CAIP + env: env as ENV, + }); + + console.log('PushAPI.user.getFeeds | Response - 200 OK'); + if (!silent) { + console.log(notifications); + } +} + +// Push Notification - PushAPI.user.getFeeds - Spam +async function PushAPI_user_getFeeds__spam(silent = !showAPIResponse) { + const notifications = await PushAPI.user.getFeeds({ + user: `eip155:5:${signerAddress}`, // user address in CAIP + spam: true, + env: env as ENV, + }); + + console.log('PushAPI.user.getFeeds [Spam] | Response - 200 OK'); + if (!silent) { + console.log(notifications); + } +} + +// Push Notification - PushAPI.user.getSubscriptions +async function PushAPI_user_getSubscriptions(silent = !showAPIResponse) { + const subscriptions = await PushAPI.user.getSubscriptions({ + user: `eip155:5:${signerAddress}`, // user address in CAIP + env: env as ENV, + }); + + console.log('PushAPI.user.getSubscriptions | Response - 200 OK'); + if (!silent) { + console.log(subscriptions); + } +} + +// Push Notification - PushAPI.channels.getChannel +async function PushAPI_channels_getChannel(silent = !showAPIResponse) { + const channelData = await PushAPI.channels.getChannel({ + channel: channelAddress as string, + env: env as ENV, + }); + + console.log('PushAPI.channels.getChannel | Response - 200 OK'); + if (!silent) { + console.log(channelData); + } +} + +// Push Notification - PushAPI.channels.search +async function PushAPI_channels_search(silent = !showAPIResponse) { + const channelsData = await PushAPI.channels.search({ + query: 'push', // a search query + page: 1, // page index + limit: 20, // no of items per page + env: env as ENV, + }); + + console.log('PushAPI.channels.search | Response - 200 OK'); + if (!silent) { + console.log(channelsData); + } +} + +// Push Notification - PushAPI.channels.subscribe +async function PushAPI_channels_subscribe(silent = !showAPIResponse) { + const response = await PushAPI.channels.subscribe({ + signer: signer, + channelAddress: `eip155:5:${channelAddress}`, // channel address in CAIP + userAddress: `eip155:5:${signerAddress}`, // user address in CAIP + onSuccess: () => { + console.log('opt in success'); + }, + onError: () => { + console.error('opt in error'); + }, + env: env as ENV, + }); + + console.log('PushAPI.channels.subscribe | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Notification - PushAPI.channels.unsubscribe +async function PushAPI_channels_unsubscribe(silent = !showAPIResponse) { + const response = await PushAPI.channels.unsubscribe({ + signer: signer, + channelAddress: `eip155:5:${channelAddress}`, // channel address in CAIP + userAddress: `eip155:5:${signerAddress}`, // user address in CAIP + onSuccess: () => { + console.log('opt out success'); + }, + onError: () => { + console.error('opt out error'); + }, + env: env as ENV, + }); + + console.log('PushAPI.channels.unsubscribe | Response - 200 OK'); + if (!silent) { + console.log(response); + } +} + +// Push Notification - Send Notifications +// Direct payload for single recipient(target) +// PushAPI.payloads.sendNotification +async function PushAPI_payloads_sendNotification__direct_payload_single_recipient( + silent = !showAPIResponse +) { + const apiResponse = await PushAPI.payloads.sendNotification({ + signer: signerChannel, // Need to resolve to channel address + type: 3, // target + identityType: 2, // direct payload + notification: { + title: `notification TITLE:`, + body: `notification BODY`, + }, + payload: { + title: `payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: `eip155:5:${signerAddress}`, // recipient address + channel: `eip155:5:${channelAddress}`, // your channel address + env: env as ENV, + }); + + console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); + if (!silent) { + console.log(apiResponse); + } +} + +// Push Notification - Direct payload for group of recipients(subset) +// PushAPI.payloads.sendNotification +async function PushAPI_payloads_sendNotification__direct_payload_group_of_recipient_subset( + silent = !showAPIResponse +) { + const apiResponse = await PushAPI.payloads.sendNotification({ + signer: signerChannel, // Need to resolve to channel address + type: 4, // subset + identityType: 2, // direct payload + notification: { + title: `notification TITLE:`, + body: `notification BODY`, + }, + payload: { + title: `payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: [`eip155:5:${signerAddress}`, `eip155:5:${randomWallet1}`], // recipient addresses + channel: `eip155:5:${channelAddress}`, // your channel address + env: env as ENV, + }); + + console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); + if (!silent) { + console.log(apiResponse); + } +} + +// Push Notification - Direct payload for all recipients(broadcast) +// PushAPI.payloads.sendNotification +async function PushAPI_payloads_sendNotification__direct_payload_all_recipients_brodcast( + silent = !showAPIResponse +) { + const apiResponse = await PushAPI.payloads.sendNotification({ + signer: signerChannel, // Needs to resolve to channel address + type: 1, // broadcast + identityType: 2, // direct payload + notification: { + title: `notification TITLE:`, + body: `notification BODY`, + }, + payload: { + title: `payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + channel: `eip155:5:${channelAddress}`, // your channel address + env: env as ENV, + }); + + console.log('PushAPI.payloads.sendNotification | Response - 204 OK'); + if (!silent) { + console.log(apiResponse); + } +} + +// Push Notification - Get Subscribers list from channels (DEPRECATED) +async function PushAPI_channels_getSubscribers(silent = !showAPIResponse) { + const subscribers = await PushAPI.channels._getSubscribers({ + channel: `eip155:5:${channelAddress}`, // channel address in CAIP + env: env as ENV, + }); + + console.log('PushAPI.channels._getSubscribers | Response - 200 OK'); + if (!silent) { + console.log(subscribers); + } +} + +// Push Notification - Socket Connection +async function PushSDKSocket(silent = !showAPIResponse) { + const pushSDKSocket = createSocketConnection({ + user: `eip155:5:${signerAddress}`, // CAIP, see below + socketOptions: { autoConnect: false }, + env: env as ENV, + }); + + if (!pushSDKSocket) { + throw new Error('PushSDKSocket | Socket Connection Failed'); + } + + pushSDKSocket.connect(); + + pushSDKSocket.on(EVENTS.CONNECT, async () => { + console.log('Socket Connected - will disconnect after 4 seconds'); + + // send a notification to see the result + await PushAPI_payloads_sendNotification__direct_payload_single_recipient( + true + ); + }); + + pushSDKSocket.on(EVENTS.DISCONNECT, () => { + console.log('Socket Disconnected'); + }); + + pushSDKSocket.on(EVENTS.USER_FEEDS, (feedItem) => { + // feedItem is the notification data when that notification was received + console.log('Incoming Feed from Socket'); + if (!silent) { + console.log(feedItem); + } + + // disconnect socket after this, not to be done in real implementations + pushSDKSocket.disconnect(); + }); + + const delay = (ms: number) => + new Promise((resolve) => setTimeout(resolve, ms)); + await delay(4000); +} diff --git a/packages/examples/sdk-backend-node/notification/notification.ts b/packages/examples/sdk-backend-node/notification/notification.ts new file mode 100644 index 000000000..2865fee94 --- /dev/null +++ b/packages/examples/sdk-backend-node/notification/notification.ts @@ -0,0 +1,257 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { ethers } from 'ethers'; +import { STREAM } from '@pushprotocol/restapi/src/lib/pushstream/pushStreamTypes'; + +// CONFIGS +const { env, showAPIResponse } = config; + +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +const eventlistener = async ( + pushAPI: PushAPI, + eventName: string +): Promise<void> => { + pushAPI.stream.on(eventName, (data: any) => { + if (showAPIResponse) { + console.log('Stream Event Received'); + console.log(data); + console.log('\n'); + } + }); +}; + +export const runNotificationClassUseCases = async (): Promise<void> => { + if (!process.env.WALLET_PRIVATE_KEY) { + console.log( + 'skipping PushAPI.channel examples, no private key passed in .env' + ); + return; + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // Signer Generation + const provider = new ethers.providers.JsonRpcProvider( + 'https://goerli.blockpi.network/v1/rpc/public' // Goerli Provider + ); + const signer = new ethers.Wallet( + `0x${process.env.WALLET_PRIVATE_KEY}`, + provider + ); + const randomWallet1 = ethers.Wallet.createRandom().address; + const randomWallet2 = ethers.Wallet.createRandom().address; + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + const userAlice = await PushAPI.initialize(signer, { env }); + + // Listen Stream Events for getting websocket events + console.log(`Listening ${STREAM.NOTIF} Events`); + eventlistener(userAlice, STREAM.NOTIF); + console.log(`Listening ${STREAM.NOTIF_OPS} Events`); + eventlistener(userAlice, STREAM.NOTIF_OPS); + console.log('\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.info'); + const channelInfo = await userAlice.channel.info(); + if (showAPIResponse) { + console.log(channelInfo); + } + console.log('PushAPI.channel.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.search'); + const searchedChannels = await userAlice.channel.search( + 'push' // search by name or address + ); + if (showAPIResponse) { + console.log(searchedChannels); + } + console.log('PushAPI.channel.search | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.subscribers'); + const channelSubscribers = await userAlice.channel.subscribers(); + if (showAPIResponse) { + console.log(channelSubscribers); + } + console.log('PushAPI.channel.subscribers | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.send'); + if (channelInfo) { + const broadcastNotif = await userAlice.channel.send(['*'], { + notification: { + title: 'test', + body: 'test', + }, + }); + await delay(3000); // Delay added to log the events in order + const targetedNotif = await userAlice.channel.send([signer.address], { + notification: { + title: 'test', + body: 'test', + }, + }); + await delay(3000); // Delay added to log the events in order + const subsetNotif = await userAlice.channel.send( + [randomWallet1, randomWallet2, signer.address], + { + notification: { + title: 'test', + body: 'test', + }, + } + ); + await delay(3000); // Delay added to log the events in order + if (showAPIResponse) { + console.log(broadcastNotif, targetedNotif, subsetNotif); + } + console.log('PushAPI.channel.send | Response - 200 OK\n\n'); + } else { + console.log( + 'skipping PushAPI.channel.send as no channel exists with the signer\n\n' + ); + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // These Examples requires wallet to hold some ETH & PUSH + const balance = await provider.getBalance(signer.address); + if (parseFloat(ethers.utils.formatEther(balance)) < 0.001) { + console.log( + 'skipping PushAPI.channel examples, wallet does not have enough balance to pay fee' + ); + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.create'); + if (channelInfo) { + console.log('skipping PushAPI.channel.create as it already exists\n\n'); + } else { + const createdChannel = await userAlice.channel.create({ + name: 'Test Channel', + description: 'Test Description', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + url: 'https://push.org', + }); + if (showAPIResponse) { + console.log(createdChannel); + } + console.log('PushAPI.channel.create | Response - 200 OK\n\n'); + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.update'); + const updatedChannel = await userAlice.channel.update({ + name: 'Updated Name', + description: 'Testing new description', + url: 'https://google.com', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + }); + if (showAPIResponse) { + console.log(updatedChannel); + } + console.log('PushAPI.channel.update | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.verify'); + // only verified channels can verify other channels (otherwise this action is skipped by sdk) + if (channelInfo.verified_status) { + const verifiedTrx = await userAlice.channel.verify( + '0x35B84d6848D16415177c64D64504663b998A6ab4' + ); + if (showAPIResponse) { + console.log(verifiedTrx); + } + } + console.log('PushAPI.channel.verify | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.setting'); + const channelSettingTrx = await userAlice.channel.setting([ + { type: 0, default: 1, description: 'My Notif Settings' }, + ]); + if (showAPIResponse) { + console.log(channelSettingTrx); + } + console.log('PushAPI.channel.setting | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.delegate.add'); + const addedDelegate = await userAlice.channel.delegate.add( + `eip155:5:${randomWallet1}` + ); + + if (showAPIResponse) { + console.log(addedDelegate); + } + console.log('PushAPI.channel.delegate.add | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.delegate.get'); + const delegates = await userAlice.channel.delegate.get(); + if (showAPIResponse) { + console.log(delegates); + } + console.log('PushAPI.channel.delegate.get | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.delegate.remove'); + const removedDelegate = await userAlice.channel.delegate.remove( + `eip155:5:${randomWallet1}` + ); + if (showAPIResponse) { + console.log(removedDelegate); + } + console.log('PushAPI.channel.delegate.remove | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.alias.info'); + const aliasInfo = await userAlice.channel.alias.info({ + alias: '0x35B84d6848D16415177c64D64504663b998A6ab4', + aliasChain: 'POLYGON', + }); + if (showAPIResponse) { + console.log(aliasInfo); + } + console.log('PushAPI.channel.alias.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.list'); + const inboxNotifications = await userAlice.notification.list('INBOX'); + const spamNotifications = await userAlice.notification.list('SPAM'); + if (showAPIResponse) { + console.log(inboxNotifications, spamNotifications); + } + console.log('PushAPI.notification.list | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.subscribe'); + const subscribeResponse = await userAlice.notification.subscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' // channel to subscribe + ); + if (showAPIResponse) { + console.log(subscribeResponse); + } + console.log('PushAPI.notification.subscribe | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.subscriptions'); + const aliceSubscriptions = await userAlice.notification.subscriptions(); + if (showAPIResponse) { + console.log(aliceSubscriptions); + } + console.log('PushAPI.notification.subscriptions | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.unsubscribe'); + const unsubscribeResponse = await userAlice.notification.unsubscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' // channel to unsubscribe + ); + if (showAPIResponse) { + console.log(unsubscribeResponse); + } + console.log('PushAPI.notification.unsubscribe | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- +}; diff --git a/packages/examples/sdk-backend-node/package-lock.json b/packages/examples/sdk-backend-node/package-lock.json new file mode 100644 index 000000000..d1b261a12 --- /dev/null +++ b/packages/examples/sdk-backend-node/package-lock.json @@ -0,0 +1,5600 @@ +{ + "name": "sdk-backend-node", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "sdk-backend-node", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@pushprotocol/restapi": "^1.4.17", + "@pushprotocol/socket": "^0.5.2" + } + }, + "node_modules/@ambire/signature-validator": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ambire/signature-validator/-/signature-validator-1.3.1.tgz", + "integrity": "sha512-kR6Se3nhAGf1VMeun7V2Lml9KRXB5oz64vO2zGSg+dNaGq4BPDEjsNdr0PIKXZ8651sDlRCN7V9SzL5E2ddBYQ==", + "dependencies": { + "ethers": "^5.6.5", + "tap-spec": "^5.0.0", + "tape": "^5.5.3" + } + }, + "node_modules/@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==", + "bin": { + "rlp": "bin/rlp" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@ethereumjs/util": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", + "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", + "dependencies": { + "@ethereumjs/rlp": "^4.0.1", + "ethereum-cryptography": "^2.0.0", + "micro-ftch": "^0.3.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bignumber/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ] + }, + "node_modules/@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "node_modules/@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@livepeer/core": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@livepeer/core/-/core-1.8.6.tgz", + "integrity": "sha512-VWMHaHMzNCr8YuC9hD87Ju+fwnpldEoe3y9CqOXrQPyyIgiAWfraZBA6Ard67f09X9UBGaaRcAMgMcCUs9HtKA==", + "dependencies": { + "cross-fetch": "^4.0.0", + "ms": "^3.0.0-canary.1", + "multiformats": "9.9.0", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + }, + "peerDependencies": { + "react": ">=17.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, + "node_modules/@ljharb/resumer": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@ljharb/resumer/-/resumer-0.0.1.tgz", + "integrity": "sha512-skQiAOrCfO7vRTq53cxznMpks7wS1va95UCidALlOVWqvBAzwPVErwizDwoMqNVMEn1mDq0utxZd02eIrvF1lw==", + "dependencies": { + "@ljharb/through": "^2.3.9" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/@metamask/eth-sig-util": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-5.1.0.tgz", + "integrity": "sha512-mlgziIHYlA9pi/XZerChqg4NocdOgBPB9NmxgXWQO2U2hH8RGOJQrz6j/AIKkYxgCMIE2PY000+joOwXfzeTDQ==", + "dependencies": { + "@ethereumjs/util": "^8.0.6", + "bn.js": "^4.12.0", + "ethereum-cryptography": "^2.0.0", + "ethjs-util": "^0.1.6", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@noble/curves": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", + "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", + "dependencies": { + "@noble/hashes": "1.3.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@pushprotocol/restapi": { + "version": "1.4.19", + "resolved": "https://registry.npmjs.org/@pushprotocol/restapi/-/restapi-1.4.19.tgz", + "integrity": "sha512-MGeYMX0NB2/sPSOnyvERZL2jKqeBPE6nUgySecEvW/JaUW8DsAX7KSN5IU4xvF9KpQblbUDcdXq4iW55/oZqOA==", + "dependencies": { + "@ambire/signature-validator": "^1.3.1", + "@metamask/eth-sig-util": "^5.0.2", + "axios": "^0.27.2", + "buffer": "^6.0.3", + "crypto-js": "^4.1.1", + "immer": "^10.0.2", + "joi": "^17.9.2", + "livepeer": "^2.5.8", + "openpgp": "^5.5.0", + "simple-peer": "^9.11.1", + "tslib": "^2.3.0", + "unique-names-generator": "^4.7.1", + "uuid": "^9.0.0", + "video-stream-merger": "^4.0.1" + }, + "peerDependencies": { + "ethers": "^5.6.8" + } + }, + "node_modules/@pushprotocol/socket": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@pushprotocol/socket/-/socket-0.5.2.tgz", + "integrity": "sha512-lVGMT3q8T5by6qwAhQ+zIeE/yv7oUC9eIlFux8M7WaKu/ArLBrrojD5REbr9QXXwpJIP3Q8GJUKyClZl4uGsJw==", + "dependencies": { + "socket.io-client": "^4.5.2", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "ethers": "^5.6.8" + } + }, + "node_modules/@scure/base": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz", + "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", + "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", + "dependencies": { + "@noble/curves": "~1.1.0", + "@noble/hashes": "~1.3.1", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "dependencies": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, + "node_modules/@stitches/core": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz", + "integrity": "sha512-Gfkvwk9o9kE9r9XNBmJRfV8zONvXThnm1tcuojL04Uy5uRyqg93DC83lDebl0rocZCfKSjUv+fWYtMQmEDJldg==" + }, + "node_modules/aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + }, + "node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.every": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.5.tgz", + "integrity": "sha512-FfMQJ+/joFGXpRCltbzV3znaP5QxIhLFySo0fEPn3GuoYlud9LhknMCIxdYKC2qsM/6VHoSp6YGwe3EZXrEcwQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "dependencies": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha512-Zy8ZXMyxIT6RMTeY7OP/bDndfj6bwCan7SS98CEndS6deHwWPpseeHlwarNcBim+etXnF9HBc1non5JgDaJU1g==" + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/combine-errors": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/combine-errors/-/combine-errors-3.0.3.tgz", + "integrity": "sha512-C8ikRNRMygCwaTx+Ek3Yr+OuZzgZjduCOfSQBjbM8V3MfgcjSTeto/GXP6PAwKvJz/v15b7GHZvx5rOlczFw/Q==", + "dependencies": { + "custom-error-instance": "2.1.1", + "lodash.uniqby": "4.5.0" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/core-js": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz", + "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "node_modules/custom-error-instance": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz", + "integrity": "sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg==" + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/deep-equal": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", + "integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==", + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.1", + "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-data-property": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", + "integrity": "sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==", + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/defined": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", + "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dotignore": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", + "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", + "dependencies": { + "minimatch": "^3.0.4" + }, + "bin": { + "ignored": "bin/ignored" + } + }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/engine.io-client": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz", + "integrity": "sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0", + "xmlhttprequest-ssl": "~2.0.0" + } + }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/err-code": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", + "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" + }, + "node_modules/es-abstract": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", + "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ethereum-cryptography": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz", + "integrity": "sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug==", + "dependencies": { + "@noble/curves": "1.1.0", + "@noble/hashes": "1.3.1", + "@scure/bip32": "1.3.1", + "@scure/bip39": "1.2.1" + } + }, + "node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, + "node_modules/ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "dependencies": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==", + "dependencies": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-browser-rtc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz", + "integrity": "sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ==" + }, + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-dynamic-import": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz", + "integrity": "sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hls.js": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.4.12.tgz", + "integrity": "sha512-1RBpx2VihibzE3WE9kGoVCtrhhDWTzydzElk/kyRbEOLnb1WIE+3ZabM/L8BqKFTCL3pUy4QzhXgD1Q6Igr1JA==" + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/immer": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.2.tgz", + "integrity": "sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "dependencies": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dependencies": { + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, + "node_modules/joi": { + "version": "17.10.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.10.2.tgz", + "integrity": "sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, + "node_modules/js-base64": { + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", + "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, + "node_modules/livepeer": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/livepeer/-/livepeer-2.8.6.tgz", + "integrity": "sha512-8K2lRtpgZKbv6l6cGYYMJW9qpdRKkGUuy7R7xTLkS6NaRQzaeW08vubftmbMHil8v8GX/nDmodcW2vA4oIkP0w==", + "dependencies": { + "@livepeer/core": "^1.8.6", + "@stitches/core": "^1.2.8", + "core-js": "^3.31.1", + "cross-fetch": "^4.0.0", + "hls.js": "^1.4.9", + "ms": "^3.0.0-canary.1", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + }, + "peerDependencies": { + "react": ">=17.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash._baseiteratee": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash._baseiteratee/-/lodash._baseiteratee-4.7.0.tgz", + "integrity": "sha512-nqB9M+wITz0BX/Q2xg6fQ8mLkyfF7MU7eE+MNBNjTHFKeKaZAPEzEg+E8LWxKWf1DQVflNEn9N49yAuqKh2mWQ==", + "dependencies": { + "lodash._stringtopath": "~4.8.0" + } + }, + "node_modules/lodash._basetostring": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz", + "integrity": "sha512-SwcRIbyxnN6CFEEK4K1y+zuApvWdpQdBHM/swxP962s8HIxPO3alBH5t3m/dl+f4CMUug6sJb7Pww8d13/9WSw==" + }, + "node_modules/lodash._baseuniq": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz", + "integrity": "sha512-Ja1YevpHZctlI5beLA7oc5KNDhGcPixFhcqSiORHNsp/1QTv7amAXzw+gu4YOvErqVlMVyIJGgtzeepCnnur0A==", + "dependencies": { + "lodash._createset": "~4.0.0", + "lodash._root": "~3.0.0" + } + }, + "node_modules/lodash._createset": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz", + "integrity": "sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA==" + }, + "node_modules/lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ==" + }, + "node_modules/lodash._stringtopath": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/lodash._stringtopath/-/lodash._stringtopath-4.8.0.tgz", + "integrity": "sha512-SXL66C731p0xPDC5LZg4wI5H+dJo/EO4KTqOMwLYCH3+FmmfAKJEZCm6ohGpI+T1xwsDsJCfL4OnhorllvlTPQ==", + "dependencies": { + "lodash._basetostring": "~4.12.0" + } + }, + "node_modules/lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==" + }, + "node_modules/lodash.uniqby": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.5.0.tgz", + "integrity": "sha512-IRt7cfTtHy6f1aRVA5n7kT8rgN3N1nH6MOWLcHfpWG2SH19E3JksLK38MktLxZDhlAjCP9jpIXkOnRXlu6oByQ==", + "dependencies": { + "lodash._baseiteratee": "~4.7.0", + "lodash._baseuniq": "~4.6.0" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/micro-ftch": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", + "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "3.0.0-canary.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz", + "integrity": "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g==", + "engines": { + "node": ">=12.13" + } + }, + "node_modules/multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/openpgp": { + "version": "5.10.2", + "resolved": "https://registry.npmjs.org/openpgp/-/openpgp-5.10.2.tgz", + "integrity": "sha512-nRqMp4o31rBagWB02tgfKCsocXWq4uYobZf9GDVlD5rQXBq/wRIZHiDhGX1dlDAI2inkZcPd2dSZOqmtGnsK1A==", + "dependencies": { + "asn1.js": "^5.0.0" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/parse-ms": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", + "integrity": "sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/plur": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-1.0.0.tgz", + "integrity": "sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pretty-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-2.1.0.tgz", + "integrity": "sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==", + "dependencies": { + "is-finite": "^1.0.1", + "parse-ms": "^1.0.0", + "plur": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==" + }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/re-emitter": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/re-emitter/-/re-emitter-1.1.3.tgz", + "integrity": "sha512-bHJul9CWcocrS+w5e5QrKYXV9NkbSA9hxSEyhYuctwm6keY9NXR2Xt/4A0vbMP0QvuwyfEyb4bkowYXv1ziEbg==" + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/resolve": { + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/simple-peer": { + "version": "9.11.1", + "resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-9.11.1.tgz", + "integrity": "sha512-D1SaWpOW8afq1CZGWB8xTfrT3FekjQmPValrqncJMX7QFl8YwhrPTZvMCANLtgBwwdS+7zURyqxDDEmY558tTw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "buffer": "^6.0.3", + "debug": "^4.3.2", + "err-code": "^3.0.1", + "get-browser-rtc": "^1.1.0", + "queue-microtask": "^1.2.3", + "randombytes": "^2.1.0", + "readable-stream": "^3.6.0" + } + }, + "node_modules/socket.io-client": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz", + "integrity": "sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/split": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.0.tgz", + "integrity": "sha512-3SVfJe2A0WZg3D+ZEtXqYkvpSGAVaZ1MgufNCeHioBESCqQFsuT1VcQufiopBfJZqh92ZwQ6ddL378iUSbqVNQ==", + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "dependencies": { + "internal-slot": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tap-out": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tap-out/-/tap-out-2.1.0.tgz", + "integrity": "sha512-LJE+TBoVbOWhwdz4+FQk40nmbIuxJLqaGvj3WauQw3NYYU5TdjoV3C0x/yq37YAvVyi+oeBXmWnxWSjJ7IEyUw==", + "dependencies": { + "re-emitter": "1.1.3", + "readable-stream": "2.2.9", + "split": "1.0.0", + "trim": "0.0.1" + }, + "bin": { + "tap-out": "bin/cmd.js" + } + }, + "node_modules/tap-out/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/tap-out/node_modules/readable-stream": { + "version": "2.2.9", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "integrity": "sha512-iuxqX7b7FYt08AriYECxUsK9KTXE3A/FenxIa3IPmvANHxaTP/wGIwwf+IidvvIDk/MsCp/oEV6A8CXo4SDcCg==", + "dependencies": { + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/tap-out/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/tap-out/node_modules/string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/tap-spec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tap-spec/-/tap-spec-5.0.0.tgz", + "integrity": "sha512-zMDVJiE5I6Y4XGjlueGXJIX2YIkbDN44broZlnypT38Hj/czfOXrszHNNJBF/DXR8n+x6gbfSx68x04kIEHdrw==", + "dependencies": { + "chalk": "^1.0.0", + "duplexer": "^0.1.1", + "figures": "^1.4.0", + "lodash": "^4.17.10", + "pretty-ms": "^2.1.0", + "repeat-string": "^1.5.2", + "tap-out": "^2.1.0", + "through2": "^2.0.0" + }, + "bin": { + "tap-spec": "bin/cmd.js", + "tspec": "bin/cmd.js" + } + }, + "node_modules/tape": { + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.6.6.tgz", + "integrity": "sha512-rGp2cZ3rfZ6QfTBm6yvohf8aXmDqPyzMKZwTMV12w4i+b/N2Adwlg8PlW8jLqWzlJUZhglyYaLOSrMt/ZlZkAA==", + "dependencies": { + "@ljharb/resumer": "^0.0.1", + "@ljharb/through": "^2.3.9", + "array.prototype.every": "^1.1.4", + "call-bind": "^1.0.2", + "deep-equal": "^2.2.2", + "defined": "^1.0.1", + "dotignore": "^0.1.2", + "for-each": "^0.3.3", + "get-package-type": "^0.1.0", + "glob": "^7.2.3", + "has": "^1.0.3", + "has-dynamic-import": "^2.0.1", + "inherits": "^2.0.4", + "is-regex": "^1.1.4", + "minimist": "^1.2.8", + "object-inspect": "^1.12.3", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "resolve": "^2.0.0-next.4", + "string.prototype.trim": "^1.2.7" + }, + "bin": { + "tape": "bin/tape" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/through2/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/through2/node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/through2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/through2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/through2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==", + "deprecated": "Use String.prototype.trim() instead" + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/tus-js-client": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tus-js-client/-/tus-js-client-3.1.1.tgz", + "integrity": "sha512-SZzWP62jEFLmROSRZx+uoGLKqsYWMGK/m+PiNehPVWbCm7/S9zRIMaDxiaOcKdMnFno4luaqP5E+Y1iXXPjP0A==", + "dependencies": { + "buffer-from": "^1.1.2", + "combine-errors": "^3.0.3", + "is-stream": "^2.0.0", + "js-base64": "^3.7.2", + "lodash.throttle": "^4.1.1", + "proper-lockfile": "^4.1.2", + "url-parse": "^1.5.7" + } + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "node_modules/tweetnacl-util": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", + "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==" + }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unique-names-generator": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/unique-names-generator/-/unique-names-generator-4.7.1.tgz", + "integrity": "sha512-lMx9dX+KRmG8sq6gulYYpKWZc9RlGsgBR6aoO8Qsm3qvkSJ+3rAymr+TnV8EDMrIrwuFJ4kruzMWM/OpYzPoow==", + "engines": { + "node": ">=8" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/video-stream-merger": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/video-stream-merger/-/video-stream-merger-4.0.1.tgz", + "integrity": "sha512-VazYSr8tk6S/zkOq5jpR/ryy1HnGxm5XCw+d2Ejpqy1m6d71oZpyFG82dUkgAo7dg/lk3k4TqvJPtuRUtR8URA==" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/zustand": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.4.1.tgz", + "integrity": "sha512-QCPfstAS4EBiTQzlaGP1gmorkh/UL1Leaj2tdj+zZCZ/9bm0WS7sI2wnfD5lpOszFqWJ1DcPnGoY8RDL61uokw==", + "dependencies": { + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } + } + }, + "dependencies": { + "@ambire/signature-validator": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ambire/signature-validator/-/signature-validator-1.3.1.tgz", + "integrity": "sha512-kR6Se3nhAGf1VMeun7V2Lml9KRXB5oz64vO2zGSg+dNaGq4BPDEjsNdr0PIKXZ8651sDlRCN7V9SzL5E2ddBYQ==", + "requires": { + "ethers": "^5.6.5", + "tap-spec": "^5.0.0", + "tape": "^5.5.3" + } + }, + "@ethereumjs/rlp": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.1.tgz", + "integrity": "sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==" + }, + "@ethereumjs/util": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.1.0.tgz", + "integrity": "sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA==", + "requires": { + "@ethereumjs/rlp": "^4.0.1", + "ethereum-cryptography": "^2.0.0", + "micro-ftch": "^0.3.1" + } + }, + "@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "requires": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "requires": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + } + }, + "@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "requires": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" + } + }, + "@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==" + }, + "@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" + } + }, + "@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "requires": { + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/providers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" + } + }, + "@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + }, + "dependencies": { + "bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + } + } + }, + "@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "requires": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "requires": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "requires": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "requires": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", + "requires": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@livepeer/core": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@livepeer/core/-/core-1.8.6.tgz", + "integrity": "sha512-VWMHaHMzNCr8YuC9hD87Ju+fwnpldEoe3y9CqOXrQPyyIgiAWfraZBA6Ard67f09X9UBGaaRcAMgMcCUs9HtKA==", + "requires": { + "cross-fetch": "^4.0.0", + "ms": "^3.0.0-canary.1", + "multiformats": "9.9.0", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + } + }, + "@ljharb/resumer": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@ljharb/resumer/-/resumer-0.0.1.tgz", + "integrity": "sha512-skQiAOrCfO7vRTq53cxznMpks7wS1va95UCidALlOVWqvBAzwPVErwizDwoMqNVMEn1mDq0utxZd02eIrvF1lw==", + "requires": { + "@ljharb/through": "^2.3.9" + } + }, + "@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==" + }, + "@metamask/eth-sig-util": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-5.1.0.tgz", + "integrity": "sha512-mlgziIHYlA9pi/XZerChqg4NocdOgBPB9NmxgXWQO2U2hH8RGOJQrz6j/AIKkYxgCMIE2PY000+joOwXfzeTDQ==", + "requires": { + "@ethereumjs/util": "^8.0.6", + "bn.js": "^4.12.0", + "ethereum-cryptography": "^2.0.0", + "ethjs-util": "^0.1.6", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1" + } + }, + "@noble/curves": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz", + "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==", + "requires": { + "@noble/hashes": "1.3.1" + } + }, + "@noble/hashes": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz", + "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==" + }, + "@pushprotocol/restapi": { + "version": "1.4.19", + "resolved": "https://registry.npmjs.org/@pushprotocol/restapi/-/restapi-1.4.19.tgz", + "integrity": "sha512-MGeYMX0NB2/sPSOnyvERZL2jKqeBPE6nUgySecEvW/JaUW8DsAX7KSN5IU4xvF9KpQblbUDcdXq4iW55/oZqOA==", + "requires": { + "@ambire/signature-validator": "^1.3.1", + "@metamask/eth-sig-util": "^5.0.2", + "axios": "^0.27.2", + "buffer": "^6.0.3", + "crypto-js": "^4.1.1", + "immer": "^10.0.2", + "joi": "^17.9.2", + "livepeer": "^2.5.8", + "openpgp": "^5.5.0", + "simple-peer": "^9.11.1", + "tslib": "^2.3.0", + "unique-names-generator": "^4.7.1", + "uuid": "^9.0.0", + "video-stream-merger": "^4.0.1" + } + }, + "@pushprotocol/socket": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@pushprotocol/socket/-/socket-0.5.2.tgz", + "integrity": "sha512-lVGMT3q8T5by6qwAhQ+zIeE/yv7oUC9eIlFux8M7WaKu/ArLBrrojD5REbr9QXXwpJIP3Q8GJUKyClZl4uGsJw==", + "requires": { + "socket.io-client": "^4.5.2", + "tslib": "^2.3.0" + } + }, + "@scure/base": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz", + "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==" + }, + "@scure/bip32": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz", + "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==", + "requires": { + "@noble/curves": "~1.1.0", + "@noble/hashes": "~1.3.1", + "@scure/base": "~1.1.0" + } + }, + "@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "requires": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + } + }, + "@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, + "@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, + "@stitches/core": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz", + "integrity": "sha512-Gfkvwk9o9kE9r9XNBmJRfV8zONvXThnm1tcuojL04Uy5uRyqg93DC83lDebl0rocZCfKSjUv+fWYtMQmEDJldg==" + }, + "aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==" + }, + "array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "requires": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + } + }, + "array.prototype.every": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.5.tgz", + "integrity": "sha512-FfMQJ+/joFGXpRCltbzV3znaP5QxIhLFySo0fEPn3GuoYlud9LhknMCIxdYKC2qsM/6VHoSp6YGwe3EZXrEcwQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "is-string": "^1.0.7" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "requires": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + } + }, + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + }, + "axios": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", + "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", + "requires": { + "follow-redirects": "^1.14.9", + "form-data": "^4.0.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha512-Zy8ZXMyxIT6RMTeY7OP/bDndfj6bwCan7SS98CEndS6deHwWPpseeHlwarNcBim+etXnF9HBc1non5JgDaJU1g==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "combine-errors": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/combine-errors/-/combine-errors-3.0.3.tgz", + "integrity": "sha512-C8ikRNRMygCwaTx+Ek3Yr+OuZzgZjduCOfSQBjbM8V3MfgcjSTeto/GXP6PAwKvJz/v15b7GHZvx5rOlczFw/Q==", + "requires": { + "custom-error-instance": "2.1.1", + "lodash.uniqby": "4.5.0" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "core-js": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz", + "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==" + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "requires": { + "node-fetch": "^2.6.12" + } + }, + "crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, + "custom-error-instance": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz", + "integrity": "sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg==" + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "deep-equal": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", + "integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==", + "requires": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.1", + "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + } + }, + "define-data-property": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", + "integrity": "sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==", + "requires": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "defined": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", + "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "dotignore": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", + "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", + "requires": { + "minimatch": "^3.0.4" + } + }, + "duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "engine.io-client": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz", + "integrity": "sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0", + "xmlhttprequest-ssl": "~2.0.0" + }, + "dependencies": { + "ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "requires": {} + } + } + }, + "engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==" + }, + "err-code": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", + "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" + }, + "es-abstract": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", + "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", + "requires": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.11" + } + }, + "es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + } + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "ethereum-cryptography": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz", + "integrity": "sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug==", + "requires": { + "@noble/curves": "1.1.0", + "@noble/hashes": "1.3.1", + "@scure/bip32": "1.3.1", + "@scure/bip39": "1.2.1" + } + }, + "ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "requires": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, + "ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "requires": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==", + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==" + }, + "get-browser-rtc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz", + "integrity": "sha512-MghbMJ61EJrRsDe7w1Bvqt3ZsBuqhce5nrn/XAwgwOXhcsz53/ltdxOse1h/8eKXj5slzxdsz56g5rzOFSGwfQ==" + }, + "get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + } + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==" + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "requires": { + "define-properties": "^1.1.3" + } + }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==" + }, + "has-dynamic-import": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz", + "integrity": "sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "requires": { + "get-intrinsic": "^1.1.1" + } + }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==" + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hls.js": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.4.12.tgz", + "integrity": "sha512-1RBpx2VihibzE3WE9kGoVCtrhhDWTzydzElk/kyRbEOLnb1WIE+3ZabM/L8BqKFTCL3pUy4QzhXgD1Q6Igr1JA==" + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "immer": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.0.2.tgz", + "integrity": "sha512-Rx3CqeqQ19sxUtYV9CU911Vhy8/721wRFnJv3REVGWUmoAcIwzifTsdmJte/MV+0/XpM35LZdQMBGkRIoLPwQA==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "requires": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + } + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" + }, + "is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==" + }, + "is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==" + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==" + }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==" + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "requires": { + "which-typed-array": "^1.1.11" + } + }, + "is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==" + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, + "joi": { + "version": "17.10.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.10.2.tgz", + "integrity": "sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, + "js-base64": { + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", + "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, + "livepeer": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/livepeer/-/livepeer-2.8.6.tgz", + "integrity": "sha512-8K2lRtpgZKbv6l6cGYYMJW9qpdRKkGUuy7R7xTLkS6NaRQzaeW08vubftmbMHil8v8GX/nDmodcW2vA4oIkP0w==", + "requires": { + "@livepeer/core": "^1.8.6", + "@stitches/core": "^1.2.8", + "core-js": "^3.31.1", + "cross-fetch": "^4.0.0", + "hls.js": "^1.4.9", + "ms": "^3.0.0-canary.1", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash._baseiteratee": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash._baseiteratee/-/lodash._baseiteratee-4.7.0.tgz", + "integrity": "sha512-nqB9M+wITz0BX/Q2xg6fQ8mLkyfF7MU7eE+MNBNjTHFKeKaZAPEzEg+E8LWxKWf1DQVflNEn9N49yAuqKh2mWQ==", + "requires": { + "lodash._stringtopath": "~4.8.0" + } + }, + "lodash._basetostring": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz", + "integrity": "sha512-SwcRIbyxnN6CFEEK4K1y+zuApvWdpQdBHM/swxP962s8HIxPO3alBH5t3m/dl+f4CMUug6sJb7Pww8d13/9WSw==" + }, + "lodash._baseuniq": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz", + "integrity": "sha512-Ja1YevpHZctlI5beLA7oc5KNDhGcPixFhcqSiORHNsp/1QTv7amAXzw+gu4YOvErqVlMVyIJGgtzeepCnnur0A==", + "requires": { + "lodash._createset": "~4.0.0", + "lodash._root": "~3.0.0" + } + }, + "lodash._createset": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz", + "integrity": "sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA==" + }, + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ==" + }, + "lodash._stringtopath": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/lodash._stringtopath/-/lodash._stringtopath-4.8.0.tgz", + "integrity": "sha512-SXL66C731p0xPDC5LZg4wI5H+dJo/EO4KTqOMwLYCH3+FmmfAKJEZCm6ohGpI+T1xwsDsJCfL4OnhorllvlTPQ==", + "requires": { + "lodash._basetostring": "~4.12.0" + } + }, + "lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==" + }, + "lodash.uniqby": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.5.0.tgz", + "integrity": "sha512-IRt7cfTtHy6f1aRVA5n7kT8rgN3N1nH6MOWLcHfpWG2SH19E3JksLK38MktLxZDhlAjCP9jpIXkOnRXlu6oByQ==", + "requires": { + "lodash._baseiteratee": "~4.7.0", + "lodash._baseuniq": "~4.6.0" + } + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "micro-ftch": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/micro-ftch/-/micro-ftch-0.3.1.tgz", + "integrity": "sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" + }, + "ms": { + "version": "3.0.0-canary.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz", + "integrity": "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g==" + }, + "multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + }, + "object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + } + }, + "openpgp": { + "version": "5.10.2", + "resolved": "https://registry.npmjs.org/openpgp/-/openpgp-5.10.2.tgz", + "integrity": "sha512-nRqMp4o31rBagWB02tgfKCsocXWq4uYobZf9GDVlD5rQXBq/wRIZHiDhGX1dlDAI2inkZcPd2dSZOqmtGnsK1A==", + "requires": { + "asn1.js": "^5.0.0" + } + }, + "parse-ms": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", + "integrity": "sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "plur": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-1.0.0.tgz", + "integrity": "sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==" + }, + "pretty-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-2.1.0.tgz", + "integrity": "sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==", + "requires": { + "is-finite": "^1.0.1", + "parse-ms": "^1.0.0", + "plur": "^1.0.0" + } + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==" + }, + "proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "requires": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "re-emitter": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/re-emitter/-/re-emitter-1.1.3.tgz", + "integrity": "sha512-bHJul9CWcocrS+w5e5QrKYXV9NkbSA9hxSEyhYuctwm6keY9NXR2Xt/4A0vbMP0QvuwyfEyb4bkowYXv1ziEbg==" + }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==" + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "resolve": { + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==" + }, + "safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + }, + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "requires": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + } + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "simple-peer": { + "version": "9.11.1", + "resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-9.11.1.tgz", + "integrity": "sha512-D1SaWpOW8afq1CZGWB8xTfrT3FekjQmPValrqncJMX7QFl8YwhrPTZvMCANLtgBwwdS+7zURyqxDDEmY558tTw==", + "requires": { + "buffer": "^6.0.3", + "debug": "^4.3.2", + "err-code": "^3.0.1", + "get-browser-rtc": "^1.1.0", + "queue-microtask": "^1.2.3", + "randombytes": "^2.1.0", + "readable-stream": "^3.6.0" + } + }, + "socket.io-client": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz", + "integrity": "sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.5.2", + "socket.io-parser": "~4.2.4" + } + }, + "socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + } + }, + "split": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.0.tgz", + "integrity": "sha512-3SVfJe2A0WZg3D+ZEtXqYkvpSGAVaZ1MgufNCeHioBESCqQFsuT1VcQufiopBfJZqh92ZwQ6ddL378iUSbqVNQ==", + "requires": { + "through": "2" + } + }, + "stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "requires": { + "internal-slot": "^1.0.4" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "tap-out": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tap-out/-/tap-out-2.1.0.tgz", + "integrity": "sha512-LJE+TBoVbOWhwdz4+FQk40nmbIuxJLqaGvj3WauQw3NYYU5TdjoV3C0x/yq37YAvVyi+oeBXmWnxWSjJ7IEyUw==", + "requires": { + "re-emitter": "1.1.3", + "readable-stream": "2.2.9", + "split": "1.0.0", + "trim": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "readable-stream": { + "version": "2.2.9", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "integrity": "sha512-iuxqX7b7FYt08AriYECxUsK9KTXE3A/FenxIa3IPmvANHxaTP/wGIwwf+IidvvIDk/MsCp/oEV6A8CXo4SDcCg==", + "requires": { + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "tap-spec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tap-spec/-/tap-spec-5.0.0.tgz", + "integrity": "sha512-zMDVJiE5I6Y4XGjlueGXJIX2YIkbDN44broZlnypT38Hj/czfOXrszHNNJBF/DXR8n+x6gbfSx68x04kIEHdrw==", + "requires": { + "chalk": "^1.0.0", + "duplexer": "^0.1.1", + "figures": "^1.4.0", + "lodash": "^4.17.10", + "pretty-ms": "^2.1.0", + "repeat-string": "^1.5.2", + "tap-out": "^2.1.0", + "through2": "^2.0.0" + } + }, + "tape": { + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.6.6.tgz", + "integrity": "sha512-rGp2cZ3rfZ6QfTBm6yvohf8aXmDqPyzMKZwTMV12w4i+b/N2Adwlg8PlW8jLqWzlJUZhglyYaLOSrMt/ZlZkAA==", + "requires": { + "@ljharb/resumer": "^0.0.1", + "@ljharb/through": "^2.3.9", + "array.prototype.every": "^1.1.4", + "call-bind": "^1.0.2", + "deep-equal": "^2.2.2", + "defined": "^1.0.1", + "dotignore": "^0.1.2", + "for-each": "^0.3.3", + "get-package-type": "^0.1.0", + "glob": "^7.2.3", + "has": "^1.0.3", + "has-dynamic-import": "^2.0.1", + "inherits": "^2.0.4", + "is-regex": "^1.1.4", + "minimist": "^1.2.8", + "object-inspect": "^1.12.3", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "resolve": "^2.0.0-next.4", + "string.prototype.trim": "^1.2.7" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==" + }, + "tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "tus-js-client": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tus-js-client/-/tus-js-client-3.1.1.tgz", + "integrity": "sha512-SZzWP62jEFLmROSRZx+uoGLKqsYWMGK/m+PiNehPVWbCm7/S9zRIMaDxiaOcKdMnFno4luaqP5E+Y1iXXPjP0A==", + "requires": { + "buffer-from": "^1.1.2", + "combine-errors": "^3.0.3", + "is-stream": "^2.0.0", + "js-base64": "^3.7.2", + "lodash.throttle": "^4.1.1", + "proper-lockfile": "^4.1.2", + "url-parse": "^1.5.7" + } + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "tweetnacl-util": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", + "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==" + }, + "typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + } + }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, + "unique-names-generator": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/unique-names-generator/-/unique-names-generator-4.7.1.tgz", + "integrity": "sha512-lMx9dX+KRmG8sq6gulYYpKWZc9RlGsgBR6aoO8Qsm3qvkSJ+3rAymr+TnV8EDMrIrwuFJ4kruzMWM/OpYzPoow==" + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "requires": {} + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + }, + "video-stream-merger": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/video-stream-merger/-/video-stream-merger-4.0.1.tgz", + "integrity": "sha512-VazYSr8tk6S/zkOq5jpR/ryy1HnGxm5XCw+d2Ejpqy1m6d71oZpyFG82dUkgAo7dg/lk3k4TqvJPtuRUtR8URA==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "requires": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + } + }, + "which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "requires": {} + }, + "xmlhttprequest-ssl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, + "zustand": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.4.1.tgz", + "integrity": "sha512-QCPfstAS4EBiTQzlaGP1gmorkh/UL1Leaj2tdj+zZCZ/9bm0WS7sI2wnfD5lpOszFqWJ1DcPnGoY8RDL61uokw==", + "requires": { + "use-sync-external-store": "1.2.0" + } + } + } +} diff --git a/packages/examples/sdk-backend-node/package.json b/packages/examples/sdk-backend-node/package.json index 97b7d47cb..a75fdb60c 100644 --- a/packages/examples/sdk-backend-node/package.json +++ b/packages/examples/sdk-backend-node/package.json @@ -11,7 +11,7 @@ "author": "", "license": "ISC", "dependencies": { - "@pushprotocol/restapi": "^1.4.17", + "@pushprotocol/restapi": "0.0.1-alpha.44", "@pushprotocol/socket": "^0.5.2" } } diff --git a/packages/examples/sdk-backend-node/pushAPI/channel.ts b/packages/examples/sdk-backend-node/pushAPI/channel.ts new file mode 100644 index 000000000..c33154a92 --- /dev/null +++ b/packages/examples/sdk-backend-node/pushAPI/channel.ts @@ -0,0 +1,192 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { ethers } from 'ethers'; + +// CONFIGS +const { env, showAPIResponse } = config; + +export const runPushAPIChannelCases = async (): Promise<void> => { + if (!process.env.WALLET_PRIVATE_KEY) { + console.log( + 'skipping PushAPI.channel examples, no private key passed in .env' + ); + return; + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // Signer Generation + const provider = new ethers.providers.JsonRpcProvider( + 'https://goerli.blockpi.network/v1/rpc/public' // Goerli Provider + ); + const signer = new ethers.Wallet( + `0x${process.env.WALLET_PRIVATE_KEY}`, + provider + ); + const randomWallet1 = ethers.Wallet.createRandom().address; + const randomWallet2 = ethers.Wallet.createRandom().address; + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + const userAlice = await PushAPI.initialize(signer, { env }); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.info'); + const channelInfo = await userAlice.channel.info(); + if (showAPIResponse) { + console.log(channelInfo); + } + console.log('PushAPI.channel.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.search'); + const searchedChannels = await userAlice.channel.search( + 'push' // search by name or address + ); + if (showAPIResponse) { + console.log(searchedChannels); + } + console.log('PushAPI.channel.search | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.subscribers'); + const channelSubscribers = await userAlice.channel.subscribers(); + if (showAPIResponse) { + console.log(channelSubscribers); + } + console.log('PushAPI.channel.subscribers | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.send'); + if (channelInfo) { + const broadcastNotif = await userAlice.channel.send(['*'], { + notification: { + title: 'test', + body: 'test', + }, + }); + const targetedNotif = await userAlice.channel.send([randomWallet1], { + notification: { + title: 'test', + body: 'test', + }, + }); + const subsetNotif = await userAlice.channel.send( + [randomWallet1, randomWallet2], + { + notification: { + title: 'test', + body: 'test', + }, + } + ); + if (showAPIResponse) { + console.log(broadcastNotif, targetedNotif, subsetNotif); + } + console.log('PushAPI.channel.send | Response - 200 OK\n\n'); + } else { + console.log( + 'skipping PushAPI.channel.send as no channel exists with the signer\n\n' + ); + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + // These Examples requires wallet to hold some ETH & PUSH + const balance = await provider.getBalance(signer.address); + if (parseFloat(ethers.utils.formatEther(balance)) < 0.001) { + console.log( + 'skipping PushAPI.channel examples, wallet does not have enough balance to pay fee' + ); + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.create'); + if (channelInfo) { + console.log('skipping PushAPI.channel.create as it already exists\n\n'); + } else { + const createdChannel = await userAlice.channel.create({ + name: 'Test Channel', + description: 'Test Description', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + url: 'https://push.org', + }); + if (showAPIResponse) { + console.log(createdChannel); + } + console.log('PushAPI.channel.create | Response - 200 OK\n\n'); + } + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.update'); + const updatedChannel = await userAlice.channel.update({ + name: 'Updated Name', + description: 'Testing new description', + url: 'https://google.com', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + }); + if (showAPIResponse) { + console.log(updatedChannel); + } + console.log('PushAPI.channel.update | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.verify'); + // only verified channels can verify other channels (otherwise this action is skipped by sdk) + if (channelInfo.verified_status) { + const verifiedTrx = await userAlice.channel.verify( + '0x35B84d6848D16415177c64D64504663b998A6ab4' + ); + if (showAPIResponse) { + console.log(verifiedTrx); + } + } + console.log('PushAPI.channel.verify | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.setting'); + const channelSettingTrx = await userAlice.channel.setting([ + { type: 1, default: 1, description: 'My Notif Settings' }, + ]); + if (showAPIResponse) { + console.log(channelSettingTrx); + } + console.log('PushAPI.channel.setting | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.delegate.add'); + const addedDelegate = await userAlice.channel.delegate.add( + `eip155:5:${randomWallet1}` + ); + + if (showAPIResponse) { + console.log(addedDelegate); + } + console.log('PushAPI.channel.delegate.add | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.delegate.get'); + const delegates = await userAlice.channel.delegate.get(); + if (showAPIResponse) { + console.log(delegates); + } + console.log('PushAPI.channel.delegate.get | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.delegate.remove'); + const removedDelegate = await userAlice.channel.delegate.remove( + `eip155:5:${randomWallet1}` + ); + if (showAPIResponse) { + console.log(removedDelegate); + } + console.log('PushAPI.channel.delegate.remove | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.channel.alias.info'); + const aliasInfo = await userAlice.channel.alias.info({ + alias: '0x35B84d6848D16415177c64D64504663b998A6ab4', + aliasChain: 'POLYGON', + }); + if (showAPIResponse) { + console.log(aliasInfo); + } + console.log('PushAPI.channel.alias.info | Response - 200 OK\n\n'); +}; diff --git a/packages/examples/sdk-backend-node/pushAPI/index.ts b/packages/examples/sdk-backend-node/pushAPI/chat.ts similarity index 69% rename from packages/examples/sdk-backend-node/pushAPI/index.ts rename to packages/examples/sdk-backend-node/pushAPI/chat.ts index e14d56659..f34973ec1 100644 --- a/packages/examples/sdk-backend-node/pushAPI/index.ts +++ b/packages/examples/sdk-backend-node/pushAPI/chat.ts @@ -34,6 +34,7 @@ const thirdSigner = createWalletClient({ transport: http(), }); const thirdSignerAddress = thirdSigner.account.address; + // Dummy Wallet Addresses const randomWallet1 = privateKeyToAccount(generatePrivateKey()).address; const randomWallet2 = privateKeyToAccount(generatePrivateKey()).address; @@ -51,47 +52,10 @@ const groupImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; /***************** SAMPLE GROUP DATA ****************************/ -export const runPushAPICases = async (): Promise<void> => { - console.log(` - -██████╗░██╗░░░██╗░██████╗██╗░░██╗░█████╗░██████╗░██╗ ░█████╗░██╗░░░░░░█████╗░░██████╗░██████╗ -██╔══██╗██║░░░██║██╔════╝██║░░██║██╔══██╗██╔══██╗██║ ██╔══██╗██║░░░░░██╔══██╗██╔════╝██╔════╝ -██████╔╝██║░░░██║╚█████╗░███████║███████║██████╔╝██║ ██║░░╚═╝██║░░░░░███████║╚█████╗░╚█████╗░ -██╔═══╝░██║░░░██║░╚═══██╗██╔══██║██╔══██║██╔═══╝░██║ ██║░░██╗██║░░░░░██╔══██║░╚═══██╗░╚═══██╗ -██║░░░░░╚██████╔╝██████╔╝██║░░██║██║░░██║██║░░░░░██║ ╚█████╔╝███████╗██║░░██║██████╔╝██████╔╝ -╚═╝░░░░░░╚═════╝░╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░░░░╚═╝ ░╚════╝░╚══════╝╚═╝░░╚═╝╚═════╝░╚═════╝░ - `); - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - console.log('PushAPI.initialize'); +export const runPushAPIChatCases = async (): Promise<void> => { const userAlice = await PushAPI.initialize(signer, { env }); const userBob = await PushAPI.initialize(secondSigner, { env }); - console.log('PushAPI.initialize | Response - 200 OK\n\n'); - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - console.log('PushAPI.info'); - const userAliceInfo = await userAlice.info(); - if (showAPIResponse) { - console.log(userAliceInfo); - } - console.log('PushAPI.info | Response - 200 OK\n\n'); - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - console.log('PushAPI.profile.info'); - const userAliceProfileInfo = await userAlice.profile.info(); - if (showAPIResponse) { - console.log(userAliceProfileInfo); - } - console.log('PushAPI.profile.info | Response - 200 OK\n\n'); - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - console.log('PushAPI.profile.update'); - const updatedName = 'Bob The Builder'; - const response = await userAlice.profile.update({ name: updatedName }); - if (showAPIResponse) { - console.log(response); - } - console.log('PushAPI.profile.update | Response - 200 OK\n\n'); + const tempUser = await PushAPI.initialize(thirdSigner, { env }); // ------------------------------------------------------------------- // ------------------------------------------------------------------- console.log('PushAPI.chat.list'); @@ -144,9 +108,9 @@ export const runPushAPICases = async (): Promise<void> => { // ------------------------------------------------------------------- // ------------------------------------------------------------------- console.log('PushAPI.chat.reject'); - const tempUser = await PushAPI.initialize(thirdSigner, { env }); await tempUser.chat.send(secondSignerAddress, { - content: 'Sending Malicious message to bob', + content: 'Sending malicious message', + type: 'Text', }); const bobRejectsRequest = await userBob.chat.reject(thirdSignerAddress); if (showAPIResponse) { @@ -258,26 +222,6 @@ export const runPushAPICases = async (): Promise<void> => { admins: [], private: true, }); - const rejectGrpJoiningReq = await userBob.chat.group.reject(sampleGrp.chatId); - if (showAPIResponse) { - console.log(rejectGrpJoiningReq); - } + await userBob.chat.group.reject(sampleGrp.chatId); console.log('PushAPI.group.reject | Response - 200 OK\n\n'); - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - console.log('PushAPI.encryption.info'); - const encryptionInfo = await userAlice.encryption.info(); - if (showAPIResponse) { - console.log(encryptionInfo); - } - console.log('PushAPI.encryption.info | Response - 200 OK\n\n'); - // ------------------------------------------------------------------- - // ------------------------------------------------------------------- - console.log('PushAPI.encryption.update'); - const PGP_V3 = 'eip191-aes256-gcm-hkdf-sha256'; - const encryptionUpdate = await userAlice.encryption.update(PGP_V3 as any); - if (showAPIResponse) { - console.log(encryptionUpdate); - } - console.log('PushAPI.encryption.update | Response - 200 OK\n\n'); }; diff --git a/packages/examples/sdk-backend-node/pushAPI/encryption.ts b/packages/examples/sdk-backend-node/pushAPI/encryption.ts new file mode 100644 index 000000000..67300c65f --- /dev/null +++ b/packages/examples/sdk-backend-node/pushAPI/encryption.ts @@ -0,0 +1,38 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { createWalletClient, http } from 'viem'; +import { goerli } from 'viem/chains'; + +// CONFIGS +const { env, showAPIResponse } = config; + +/***************** SAMPLE SIGNER GENERATION *********************/ +// Uing VIEM +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); + +export const runPushAPIEncryptionCases = async (): Promise<void> => { + const userAlice = await PushAPI.initialize(signer, { env }); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.encryption.info'); + const encryptionInfo = await userAlice.encryption.info(); + if (showAPIResponse) { + console.log(encryptionInfo); + } + console.log('PushAPI.encryption.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.encryption.update'); + const PGP_V3 = 'eip191-aes256-gcm-hkdf-sha256'; + const encryptionUpdate = await userAlice.encryption.update(PGP_V3 as any); + if (showAPIResponse) { + console.log(encryptionUpdate); + } + console.log('PushAPI.encryption.update | Response - 200 OK\n\n'); +}; diff --git a/packages/examples/sdk-backend-node/pushAPI/notification.ts b/packages/examples/sdk-backend-node/pushAPI/notification.ts new file mode 100644 index 000000000..579ea1e2b --- /dev/null +++ b/packages/examples/sdk-backend-node/pushAPI/notification.ts @@ -0,0 +1,58 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { createWalletClient, http } from 'viem'; +import { goerli } from 'viem/chains'; + +// CONFIGS +const { env, showAPIResponse } = config; + +/***************** SAMPLE SIGNER GENERATION *********************/ +// Uing VIEM +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); + +export const runPushAPINotificationCases = async (): Promise<void> => { + const userAlice = await PushAPI.initialize(signer, { env }); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.list'); + const inboxNotifications = await userAlice.notification.list('INBOX'); + const spamNotifications = await userAlice.notification.list('SPAM'); + if (showAPIResponse) { + console.log(inboxNotifications, spamNotifications); + } + console.log('PushAPI.notification.list | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.subscribe'); + const subscribeResponse = await userAlice.notification.subscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' // channel to subscribe + ); + if (showAPIResponse) { + console.log(subscribeResponse); + } + console.log('PushAPI.notification.subscribe | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.subscriptions'); + const aliceSubscriptions = await userAlice.notification.subscriptions(); + if (showAPIResponse) { + console.log(aliceSubscriptions); + } + console.log('PushAPI.notification.subscriptions | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.notification.unsubscribe'); + const unsubscribeResponse = await userAlice.notification.unsubscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' // channel to unsubscribe + ); + if (showAPIResponse) { + console.log(unsubscribeResponse); + } + console.log('PushAPI.notification.unsubscribe | Response - 200 OK\n\n'); +}; diff --git a/packages/examples/sdk-backend-node/pushAPI/profile.ts b/packages/examples/sdk-backend-node/pushAPI/profile.ts new file mode 100644 index 000000000..f72d93f1b --- /dev/null +++ b/packages/examples/sdk-backend-node/pushAPI/profile.ts @@ -0,0 +1,38 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { createWalletClient, http } from 'viem'; +import { goerli } from 'viem/chains'; + +// CONFIGS +const { env, showAPIResponse } = config; + +/***************** SAMPLE SIGNER GENERATION *********************/ +// Uing VIEM +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); + +export const runPushAPIProfileCases = async (): Promise<void> => { + const userAlice = await PushAPI.initialize(signer, { env }); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.profile.info'); + const userAliceProfileInfo = await userAlice.profile.info(); + if (showAPIResponse) { + console.log(userAliceProfileInfo); + } + console.log('PushAPI.profile.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.profile.update'); + const updatedName = 'Bob The Builder'; + const response = await userAlice.profile.update({ name: updatedName }); + if (showAPIResponse) { + console.log(response); + } + console.log('PushAPI.profile.update | Response - 200 OK\n\n'); +}; diff --git a/packages/examples/sdk-backend-node/pushAPI/stream.ts b/packages/examples/sdk-backend-node/pushAPI/stream.ts new file mode 100644 index 000000000..e10c599c8 --- /dev/null +++ b/packages/examples/sdk-backend-node/pushAPI/stream.ts @@ -0,0 +1,202 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { createWalletClient, http } from 'viem'; +import { goerli } from 'viem/chains'; +import { STREAM } from '@pushprotocol/restapi/src/lib/pushstream/pushStreamTypes'; + +// CONFIGS +const { env, showAPIResponse } = config; + +/***************** SAMPLE SIGNER GENERATION *********************/ +// Uing VIEM +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const signerAddress = signer.account.address; +const secondSigner = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const secondSignerAddress = secondSigner.account.address; +const thirdSigner = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); +const thirdSignerAddress = thirdSigner.account.address; +// Dummy Wallet Addresses +const randomWallet1 = privateKeyToAccount(generatePrivateKey()).address; + +const eventlistener = async ( + pushAPI: PushAPI, + eventName: string +): Promise<void> => { + pushAPI.stream.on(eventName, (data: any) => { + if (showAPIResponse) { + console.log(data); + } + }); +}; + +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +export const runPushAPIStreamCases = async (): Promise<void> => { + const userAlice = await PushAPI.initialize(signer, { env }); + const userBob = await PushAPI.initialize(secondSigner, { env }); + const userKate = await PushAPI.initialize(thirdSigner, { env }); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log(`Listening ${STREAM.PROFILE} Events`); + eventlistener(userAlice, STREAM.PROFILE); + console.log(`Listening ${STREAM.ENCRYPTION} Events`); + eventlistener(userAlice, STREAM.ENCRYPTION); + console.log(`Listening ${STREAM.NOTIF} Events`); + eventlistener(userAlice, STREAM.NOTIF); + console.log(`Listening ${STREAM.NOTIF_OPS} Events`); + eventlistener(userAlice, STREAM.NOTIF_OPS); + console.log(`Listening ${STREAM.CHAT} Events`); + eventlistener(userAlice, STREAM.CHAT); + console.log(`Listening ${STREAM.CHAT_OPS} Events`); + eventlistener(userAlice, STREAM.CHAT_OPS); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nNew Chat Request, Expected Events:\n1. chat.request'); + await userAlice.chat.send(secondSignerAddress, { + content: 'Hello Bob! from Alice', + }); + await delay(3000); // Delay added to log the events in order + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nNew Chat Request, Expected Events:\n1. chat.request'); + await userAlice.chat.send(thirdSignerAddress, { + content: 'Hello Kate! from Alice', + }); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nChat Request Accept, Expected Events:\n1. chat.accept'); + await userBob.chat.accept(signerAddress); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nChat Request Reject, Expected Events:\n1. chat.reject'); + await userKate.chat.reject(signerAddress); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nCreate Chat Group, Expected Events:\n1. chat.group.create'); + const groupChatId = ( + await userAlice.chat.group.create('Test Grp', { + description: 'Test Desc', + image: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + members: [secondSignerAddress, thirdSignerAddress], + admins: [], + private: false, + }) + ).chatId; + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nUpdate Chat Group, Expected Events:\n1. chat.group.update'); + await userAlice.chat.group.update(groupChatId, { + description: 'Updated Test Desc', + image: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + }); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nAdd member to Group, Expected Events:\n1. chat.request'); + await userAlice.chat.group.add(groupChatId, { + role: 'MEMBER', + accounts: [randomWallet1], + }); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log( + '\n\nRemove member from Group, Expected Events:\n1. chat.group.participant.remove' + ); + await userAlice.chat.group.remove(groupChatId, { + role: 'MEMBER', + accounts: [randomWallet1], + }); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nAdd Admin to Group, Expected Events:\n1. chat.request'); + await userAlice.chat.group.add(groupChatId, { + role: 'ADMIN', + accounts: [randomWallet1], + }); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log( + '\n\nRemove Admin from Group, Expected Events:\n1. chat.group.participant.remove' + ); + await userAlice.chat.group.remove(groupChatId, { + role: 'ADMIN', + accounts: [randomWallet1], + }); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('\n\nJoin Group, Expected Events:\n1. chat.accept'); + await userBob.chat.group.join(groupChatId); + await delay(3000); + //------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log( + '\n\nLeave Group, Expected Events:\n1. chat.group.participant.leave' + ); + await userBob.chat.group.leave(groupChatId); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log( + '\n\nReject Group Joining Request, Expected Events:\n1. chat.reject' + ); + await userKate.chat.group.reject(groupChatId); + await delay(3000); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + if (process.env.WALLET_PRIVATE_KEY) { + // create signer + const channelSigner = createWalletClient({ + account: privateKeyToAccount(`0x${process.env.WALLET_PRIVATE_KEY}`), + chain: goerli, + transport: http(), + }); + + await userAlice.notification.subscribe( + `eip155:5:${channelSigner.account.address}` // channel to subscribe + ); + + const channelUser = await PushAPI.initialize(channelSigner, { env }); + console.log( + '\n\nSend channel notification, Expected Events:\n1. notif.send' + ); + await channelUser.channel.send(['*'], { + notification: { + title: 'test', + body: 'test', + }, + }); + await delay(3000); + + await userAlice.notification.unsubscribe( + `eip155:5:${channelSigner.account.address}` // channel to subscribe + ); + } else { + console.log( + 'Skipping channel notification streams, as WALLET_PRIVATE_KEY is not present in .env' + ); + } +}; diff --git a/packages/examples/sdk-backend-node/spaces/index.ts b/packages/examples/sdk-backend-node/space/index.ts similarity index 94% rename from packages/examples/sdk-backend-node/spaces/index.ts rename to packages/examples/sdk-backend-node/space/index.ts index 64e04891d..43c7afb32 100644 --- a/packages/examples/sdk-backend-node/spaces/index.ts +++ b/packages/examples/sdk-backend-node/space/index.ts @@ -43,15 +43,14 @@ const spaceDescription = uniqueNamesGenerator({ const spaceImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; -export const runSpacesUseCases = async (): Promise<void> => { +export const runSpaceUseCases = async (): Promise<void> => { console.log(` - ███████╗██████╗ █████╗ ██████╗███████╗███████╗ - ██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝██╔════╝ - ███████╗██████╔╝███████║██║ █████╗ ███████╗ - ╚════██║██╔═══╝ ██╔══██║██║ ██╔══╝ ╚════██║ - ███████║██║ ██║ ██║╚██████╗███████╗███████║ - ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝╚══════╝ - +░██████╗██████╗░░█████╗░░█████╗░███████╗ +██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝ +╚█████╗░██████╔╝███████║██║░░╚═╝█████╗░░ +░╚═══██╗██╔═══╝░██╔══██║██║░░██╗██╔══╝░░ +██████╔╝██║░░░░░██║░░██║╚█████╔╝███████╗ +╚═════╝░╚═╝░░░░░╚═╝░░╚═╝░╚════╝░╚══════╝ `); console.log('PushAPI.user.create'); diff --git a/packages/examples/sdk-backend-node/user/index.ts b/packages/examples/sdk-backend-node/user/index.ts new file mode 100644 index 000000000..6a9dd6d30 --- /dev/null +++ b/packages/examples/sdk-backend-node/user/index.ts @@ -0,0 +1,75 @@ +import { PushAPI } from '@pushprotocol/restapi'; +import { config } from '../config'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { createWalletClient, http } from 'viem'; +import { goerli } from 'viem/chains'; + +// CONFIGS +const { env, showAPIResponse } = config; + +/***************** SAMPLE SIGNER GENERATION *********************/ +// Uing VIEM +// Random Wallet Signers +const signer = createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: goerli, + transport: http(), +}); + +export const runUserCases = async (): Promise<void> => { + console.log(` +██╗░░░██╗░██████╗███████╗██████╗░ +██║░░░██║██╔════╝██╔════╝██╔══██╗ +██║░░░██║╚█████╗░█████╗░░██████╔╝ +██║░░░██║░╚═══██╗██╔══╝░░██╔══██╗ +╚██████╔╝██████╔╝███████╗██║░░██║ +░╚═════╝░╚═════╝░╚══════╝╚═╝░░╚═╝ +`); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.initialize'); + const userAlice = await PushAPI.initialize(signer, { env }); + console.log('PushAPI.initialize | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.info'); + const userAliceInfo = await userAlice.info(); + if (showAPIResponse) { + console.log(userAliceInfo); + } + console.log('PushAPI.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.profile.info'); + const userAliceProfileInfo = await userAlice.profile.info(); + if (showAPIResponse) { + console.log(userAliceProfileInfo); + } + console.log('PushAPI.profile.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.profile.update'); + const updatedName = 'Bob The Builder'; + const response = await userAlice.profile.update({ name: updatedName }); + if (showAPIResponse) { + console.log(response); + } + console.log('PushAPI.profile.update | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.encryption.info'); + const encryptionInfo = await userAlice.encryption.info(); + if (showAPIResponse) { + console.log(encryptionInfo); + } + console.log('PushAPI.encryption.info | Response - 200 OK\n\n'); + // ------------------------------------------------------------------- + // ------------------------------------------------------------------- + console.log('PushAPI.encryption.update'); + const PGP_V3 = 'eip191-aes256-gcm-hkdf-sha256'; + const encryptionUpdate = await userAlice.encryption.update(PGP_V3 as any); + if (showAPIResponse) { + console.log(encryptionUpdate); + } + console.log('PushAPI.encryption.update | Response - 200 OK\n\n'); +}; diff --git a/packages/examples/sdk-backend-node/video/index.ts b/packages/examples/sdk-backend-node/video/index.ts index 209522514..afc8e636e 100644 --- a/packages/examples/sdk-backend-node/video/index.ts +++ b/packages/examples/sdk-backend-node/video/index.ts @@ -21,14 +21,14 @@ const videoSetData: ( let videoObject: any = null; const videoLocalStream = null; // get the local stream const videoSenderAddress = process.env.VIDEO_SENDER_ADDRESS; -const videoRecipientAddress = process.env.VIDEO_RECIPEINT_ADDRESS; +const videoRecipientAddress = process.env.VIDEO_RECIPIENT_ADDRESS; const videoChatId = process.env.VIDEO_CHAT_ID; let videoSignalData_1: any = null; const skipExample = () => { const requiredEnvVars = [ 'VIDEO_SENDER_ADDRESS', - 'VIDEO_RECIPEINT_ADDRESS', + 'VIDEO_RECIPIENT_ADDRESS', 'VIDEO_CHAT_ID', 'VIDEO_CHAIN_ID', ]; @@ -45,12 +45,12 @@ const skipExample = () => { // Push Video - Run Video Use cases export const runVideoUseCases = async (): Promise<void> => { console.log(` - ██╗ ██╗██╗██████╗ ███████╗ ██████╗ - ██║ ██║██║██╔══██╗██╔════╝██╔═══██╗ - ██║ ██║██║██║ ██║█████╗ ██║ ██║ - ╚██╗ ██╔╝██║██║ ██║██╔══╝ ██║ ██║ - ╚████╔╝ ██║██████╔╝███████╗╚██████╔╝ - ╚═══╝ ╚═╝╚═════╝ ╚══════╝ ╚═════╝ +██╗░░░██╗██╗██████╗░███████╗░█████╗░ +██║░░░██║██║██╔══██╗██╔════╝██╔══██╗ +╚██╗░██╔╝██║██║░░██║█████╗░░██║░░██║ +░╚████╔╝░██║██║░░██║██╔══╝░░██║░░██║ +░░╚██╔╝░░██║██████╔╝███████╗╚█████╔╝ +░░░╚═╝░░░╚═╝╚═════╝░╚══════╝░╚════╝░ `); if (videoLocalStream === null) { diff --git a/packages/examples/sdk-frontend-react/src/app/ChatTest/ChatTest.tsx b/packages/examples/sdk-frontend-react/src/app/ChatTest/ChatTest.tsx index d898b3736..789c84588 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatTest/ChatTest.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatTest/ChatTest.tsx @@ -71,6 +71,9 @@ const ChatTest = () => { <Link to="/getGroupAccess" className="nav-button"> CHAT.GETGROUPACCESS </Link> + <Link to="/getGroupMemberStatus" className="nav-button"> + CHAT.GETGROUPMEMBERSTATUS + </Link> <Link to="/searchGroups" className="nav-button"> CHAT.SEARCHGROUPS </Link> diff --git a/packages/examples/sdk-frontend-react/src/app/ChatTest/CreateGroupTest.tsx b/packages/examples/sdk-frontend-react/src/app/ChatTest/CreateGroupTest.tsx index 4f273a383..2c52acb7d 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatTest/CreateGroupTest.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatTest/CreateGroupTest.tsx @@ -106,7 +106,26 @@ const CreateGroupTest = () => { signer: librarySigner, env, meta: meta, - rules: rules ? JSON.parse(rules) as Rules : undefined + rules: { + 'chat': { + 'conditions': [ + { + 'all': [ + { + 'type': PushAPI.ConditionType.PUSH, + 'category': 'ERC20', + 'subcategory': 'holder', + 'data': { + 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1, + 'decimals': 18 + } + } + ] + } + ] + } + } }); setSendResponse(response); diff --git a/packages/examples/sdk-frontend-react/src/app/ChatTest/GetGroupMemberStatusTest.tsx b/packages/examples/sdk-frontend-react/src/app/ChatTest/GetGroupMemberStatusTest.tsx new file mode 100644 index 000000000..085c86ac9 --- /dev/null +++ b/packages/examples/sdk-frontend-react/src/app/ChatTest/GetGroupMemberStatusTest.tsx @@ -0,0 +1,86 @@ +import { useState, useContext } from 'react'; +import { + Section, + SectionItem, + CodeFormatter, + SectionButton, +} from '../components/StyledComponents'; +import Loader from '../components/Loader'; +import { EnvContext } from '../context'; +import * as PushAPI from '@pushprotocol/restapi'; + +const GetGroupMemberStatusTest = () => { + const { env } = useContext<any>(EnvContext); + const [isLoading, setLoading] = useState(false); + const [chatId, setChatId] = useState<string>(''); + const [did, setDid] = useState<string>(''); + const [sendResponse, setSendResponse] = useState<any>(''); + + const updateChatId = (e: React.SyntheticEvent<HTMLElement>) => { + setChatId((e.target as HTMLInputElement).value); + }; + + const updateDid = (e: React.SyntheticEvent<HTMLElement>) => { + setDid((e.target as HTMLInputElement).value); + }; + + const testGetGroupMemberStatus = async () => { + try { + setLoading(true); + + const response = await PushAPI.chat.getGroupMemberStatus({ + chatId: chatId, + did: did, + env, + }); + setSendResponse(response); + } catch (e) { + console.error(e); + } finally { + setLoading(false); + } + }; + + return ( + <div> + <h2>Get Group Member Status Test Page</h2> + + <Loader show={isLoading} /> + + <Section> + <SectionItem> + <SectionButton onClick={testGetGroupMemberStatus}>get group member status</SectionButton> + </SectionItem> + <SectionItem> + <label>chatId</label> + <input + type="text" + onChange={updateChatId} + value={chatId} + style={{ width: 400, height: 30 }} + /> + </SectionItem> + <SectionItem> + <label>did</label> + <input + type="text" + onChange={updateDid} + value={did} + style={{ width: 400, height: 30 }} + /> + </SectionItem> + <SectionItem> + <div> + {sendResponse ? ( + <CodeFormatter> + {JSON.stringify(sendResponse, null, 4)} + </CodeFormatter> + ) : null} + </div> + </SectionItem> + </Section> + </div> + ); +}; + +export default GetGroupMemberStatusTest; diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx index b889f7daf..fc8c7eefb 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatProfile.tsx @@ -6,7 +6,7 @@ export const ChatProfileTest = () => { <div> <ChatProfile // chatId='0x455E5AA18469bC6ccEF49594645666C587A3a71B' - chatId='24b029b8e07e60291bf9d8c0c48ff993fa1e0a99105459f7404c425c92e91bac' + chatId='a72832107b8ae7624c1ec997cee8e8b2bc21db708465555c20c4d5e029210cd6' // chatId='36baf37e441fdd94e23406c6c716fc4e91a93a9ee68e070cd5b054534dbe09a6' style="Info" /> diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatUITest.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatUITest.tsx index 7dd92f1ff..06cdb3837 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatUITest.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatUITest.tsx @@ -38,6 +38,7 @@ const ChatUITest = () => { <Link to="/messageContainer" className="nav-button"> CHAT VIEW COMPONENT </Link> + </NavMenu> </Section> </div> diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewBubble.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewBubble.tsx index d9d184845..16cd126ad 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewBubble.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewBubble.tsx @@ -26,7 +26,7 @@ export const ChatViewBubbles = () => { const ConversationHash = await PUSHAPI.chat.conversationHash({ account: `eip155:${account}`, - conversationId: '831b1d93f36fa2fce6c3d8c7c41c53335c82ad13cbe05478579af235f10716dc', + conversationId: '196f58cbe07c7eb5716d939e0a3be1f15b22b2334d5179c601566600016860ac', env: env }); setConversationHash(ConversationHash.threadHash); diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx index bf1273fa6..2537443d6 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewComponent.tsx @@ -1,30 +1,30 @@ import styled from 'styled-components'; import { Section } from '../components/StyledComponents'; - +import { CreateGroupModal } from "@pushprotocol/uiweb"; import { ChatViewComponent } from '@pushprotocol/uiweb'; - const ChatViewComponentTest = () => { - - + const chatFilterList = [ + 'bafyreidesy6f4iu34eqccmqh55g35wu36lvlz42c63ivtmgjjhezlzdqta', + 'bafyreig3gs4tpwxumiz5fxypyt4omlxhvrvuj66kfoyioeshawlau6lgem', + ]; return ( <div> <h2>Chat UI Test page</h2> - - {/* <Loader show={isLoading} /> */} - <ChatViewComponentCard> - - <ChatViewComponent chatId='0xCD0DAdAb45bAF9a06ce1279D1342EcC3F44845af' limit={10}/> + <CreateGroupModal onClose={()=>{console.log('in close')}} /> + <ChatViewComponentCard> + <ChatViewComponent onGetTokenClick={() => console.log("BOIIII RETURNNNSSSSS")} chatId='4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68' limit={10} isConnected={true} /> </ChatViewComponentCard> </div> ); -}; +} export default ChatViewComponentTest; - const ChatViewComponentCard = styled(Section)` -height:60vh; -`; \ No newline at end of file + height: 60vh; +`; +//c2d544ad9d1efd5c5a593b143bf8232875c926cf28015564e70ad078b95f807e +//4ac5ab85c9c3d57adbdf2dba79357e56b2f9ef0256befe750d9f93af78d2ca68 diff --git a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewListTest.tsx b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewListTest.tsx index 28eec588d..69a29c15c 100644 --- a/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewListTest.tsx +++ b/packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatViewListTest.tsx @@ -3,29 +3,32 @@ import styled from 'styled-components'; import * as PUSHAPI from '@pushprotocol/restapi'; import { Link } from 'react-router-dom'; import { Section } from '../components/StyledComponents'; -import { ChatViewList } from '@pushprotocol/uiweb'; +import { ChatViewList } from '@pushprotocol/uiweb'; import { EnvContext, Web3Context } from '../context'; import { usePushChatSocket } from '@pushprotocol/uiweb'; import { MessageInput } from '@pushprotocol/uiweb'; + const ChatViewListTest = () => { - const { account, pgpPrivateKey } = useContext<any>(Web3Context) + // const { account, pgpPrivateKey } = useContext<any>(Web3Context) - const { env } = useContext<any>(EnvContext); + // const { env } = useContext<any>(EnvContext); - usePushChatSocket(); + // usePushChatSocket(); + + return ( <div> <h2>Chat UI Test page</h2> {/* <Loader show={isLoading} /> */} - - <ChatViewListCard > - <ChatViewList chatId='0xe19c4b204a76db09697ea54c9182eba2195542aD' limit={10} /> + + <ChatViewListCard> + <ChatViewList chatId='b8e068e02fe12d7136bc2f24408835573f30c6fbf0b65ea26ab4c7055a2c85f1' limit={10} /> </ChatViewListCard> - <MessageInput chatId='0xe19c4b204a76db09697ea54c9182eba2195542aD' isConnected={true} /> + {/* <MessageInput chatId='196f58cbe07c7eb5716d939e0a3be1f15b22b2334d5179c601566600016860ac' isConnected={true} /> */} </div> ); }; @@ -33,7 +36,9 @@ const ChatViewListTest = () => { export default ChatViewListTest; -const ChatViewListCard = styled(Section)` +const ChatViewListCard = styled.div` height:40vh; background:black; +overflow: auto; +overflow-x: hidden; `; \ No newline at end of file diff --git a/packages/examples/sdk-frontend-react/src/app/app.tsx b/packages/examples/sdk-frontend-react/src/app/app.tsx index 04ed98fef..98a5bd2c7 100644 --- a/packages/examples/sdk-frontend-react/src/app/app.tsx +++ b/packages/examples/sdk-frontend-react/src/app/app.tsx @@ -2,7 +2,7 @@ import { useContext, useEffect, useMemo, useState } from 'react'; import styled from 'styled-components'; import { Route, Routes, Link } from 'react-router-dom'; import { useWeb3React } from '@web3-react/core'; -import ConnectButton from './components/Connect'; +import ConnectButtonComp from './components/Connect'; import { Checkbox } from './components/Checkbox'; import Dropdown from './components/Dropdown'; import { @@ -87,6 +87,8 @@ import { lightChatTheme } from '@pushprotocol/uiweb'; import SearchSpaceTest from './SpaceTest/SearchSpaceTest'; import SearchGroupTest from './ChatTest/SearchGroupTest'; import RejectRequestTest from './ChatTest/RejectRequestTest'; +import GetGroupMemberStatusTest from './ChatTest/GetGroupMemberStatusTest'; + window.Buffer = window.Buffer || Buffer; @@ -219,6 +221,7 @@ export function App() { const { account, library, active, chainId } = useWeb3React(); const [env, setEnv] = useState<ENV>(ENV.PROD); const [isCAIP, setIsCAIP] = useState(false); + const [signer, setSigner] = useState(); const { SpaceWidgetComponent } = useSpaceComponents(); const [spaceId, setSpaceId] = useState<string>(''); @@ -246,6 +249,7 @@ export function App() { const user = await PushAPI.user.get({ account: account, env }); let pgpPrivateKey; const librarySigner = await library.getSigner(account); + setSigner(librarySigner); if (user?.encryptedPrivateKey) { pgpPrivateKey = await PushAPI.chat.decryptPGPKey({ encryptedPGPPrivateKey: user.encryptedPrivateKey, @@ -258,7 +262,6 @@ export function App() { setPgpPrivateKey(pgpPrivateKey); })(); }, [account, env, library]); - const spaceUI = useMemo( () => new SpacesUI({ @@ -277,7 +280,7 @@ export function App() { <h1>SDK Demo React App</h1> </Link> - <ConnectButton /> + <ConnectButtonComp /> <Dropdown label="ENV" @@ -310,7 +313,7 @@ export function App() { <Web3Context.Provider value={{ account, active, library, chainId }}> <SocketContext.Provider value={socketData}> <AccountContext.Provider value={{ pgpPrivateKey, setSpaceId }}> - <ChatUIProvider account={account!} pgpPrivateKey={pgpPrivateKey} env={env} theme={darkChatTheme}> + <ChatUIProvider env={env} theme={darkChatTheme} account={account} pgpPrivateKey={pgpPrivateKey} signer={signer}> <SpacesUIProvider spaceUI={spaceUI} theme={customDarkTheme}> <Routes> <Route @@ -454,6 +457,8 @@ export function App() { <Route path="/createGroup" element={<CreateGroupTest />} /> <Route path="/getGroup" element={<GetGroupTest />} /> <Route path="/getGroupAccess" element={<GetGroupAccessTest />} /> + <Route path="/getGroupMemberStatus" element={<GetGroupMemberStatusTest />} /> + <Route path="/addMembersToGroup" element={<AddMembersToGroupTest />} diff --git a/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx b/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx index 53ce68f1c..cc5b89378 100644 --- a/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx +++ b/packages/examples/sdk-frontend-react/src/app/components/Connect.tsx @@ -19,10 +19,12 @@ const NETWORK_MAPPING: NwMappingType = { 10: 'OPTIMISM_MAINNET', 1442: 'POLYGON_ZK_EVM_TESTNET', 1101: 'POLYGON_ZK_EVM_MAINNET', + 421613: "ARBITRUM_TESTNET", + 42161: "ARBITRUMONE_MAINNET" }; const injected = new InjectedConnector({ - supportedChainIds: [1, 3, 4, 5, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101], + supportedChainIds: [1, 3, 4, 5, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161], }); const ConnectWrapper = styled.div` @@ -65,7 +67,7 @@ const Disconnect = styled(StyledButton)` background: rgb(226, 8, 128); `; -const ConnectButton = () => { +const ConnectButtonComp = () => { const { active, account, activate, deactivate, chainId } = useWeb3React(); async function connect() { @@ -119,4 +121,4 @@ const ConnectButton = () => { ); }; -export default ConnectButton; +export default ConnectButtonComp; diff --git a/packages/examples/sdk-frontend-react/src/app/helpers.ts b/packages/examples/sdk-frontend-react/src/app/helpers.ts index d5af6bc15..bad12f49d 100644 --- a/packages/examples/sdk-frontend-react/src/app/helpers.ts +++ b/packages/examples/sdk-frontend-react/src/app/helpers.ts @@ -18,7 +18,7 @@ const Constants = { }, DEFAULT_CHAIN_ID: 5, DEV_CHAIN_ID: 99999, - NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101], + NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161], ETH_CHAINS: [1, 5], }; diff --git a/packages/examples/sdk-frontend/pages/index.tsx b/packages/examples/sdk-frontend/pages/index.tsx index e95310d1b..936704b2c 100644 --- a/packages/examples/sdk-frontend/pages/index.tsx +++ b/packages/examples/sdk-frontend/pages/index.tsx @@ -1,4 +1,4 @@ -import { ConnectButton } from '@rainbow-me/rainbowkit'; +import { ConnectButtonComp } from '@rainbow-me/rainbowkit'; import { NextPage } from 'next'; import Link from 'next/link'; import styled from 'styled-components'; @@ -7,7 +7,7 @@ const Index: NextPage = () => { return ( <Container> <h1>Hello Next.js 👋</h1> - <ConnectButton /> + <ConnectButtonComp /> <Button> <Link href="/video">Video</Link> </Button> diff --git a/packages/examples/sdk-frontend/pages/video.tsx b/packages/examples/sdk-frontend/pages/video.tsx index 05291f1d8..a44a90ac3 100644 --- a/packages/examples/sdk-frontend/pages/video.tsx +++ b/packages/examples/sdk-frontend/pages/video.tsx @@ -243,7 +243,7 @@ const Home: NextPage = () => { <CallInfo>Video Call Status: {data.incoming[0].status}</CallInfo> <HContainer> - <ConnectButton /> + <ConnectButtonComp /> </HContainer> {isConnected ? ( diff --git a/packages/reactnative/example/ios/Podfile.lock b/packages/reactnative/example/ios/Podfile.lock index 653b63d4d..571da8c5e 100644 --- a/packages/reactnative/example/ios/Podfile.lock +++ b/packages/reactnative/example/ios/Podfile.lock @@ -333,6 +333,8 @@ PODS: - glog - react-native-fast-openpgp (2.6.0): - React-Core + - react-native-webview (13.2.2): + - React-Core - React-perflogger (0.71.11) - React-RCTActionSheet (0.71.11): - React-Core/RCTActionSheetHeaders (= 0.71.11) @@ -470,6 +472,7 @@ DEPENDENCIES: - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - react-native-fast-openpgp (from `../node_modules/react-native-fast-openpgp`) + - react-native-webview (from `../node_modules/react-native-webview`) - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) @@ -548,6 +551,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/logger" react-native-fast-openpgp: :path: "../node_modules/react-native-fast-openpgp" + react-native-webview: + :path: "../node_modules/react-native-webview" React-perflogger: :path: "../node_modules/react-native/ReactCommon/reactperflogger" React-RCTActionSheet: @@ -612,7 +617,8 @@ SPEC CHECKSUMS: React-jsiexecutor: 18b5b33c5f2687a784a61bc8176611b73524ae77 React-jsinspector: b6ed4cb3ffa27a041cd440300503dc512b761450 React-logger: 186dd536128ae5924bc38ed70932c00aa740cd5b - react-native-fast-openpgp: 079314a83e0ed2b393e213802628db8b6cfd15ac + react-native-fast-openpgp: 25df11a0fc3a801ef8fa6bd4335cb48c66dc5bbe + react-native-webview: b8ec89966713985111a14d6e4bf98d8b54bced0d React-perflogger: e706562ab7eb8eb590aa83a224d26fa13963d7f2 React-RCTActionSheet: 57d4bd98122f557479a3359ad5dad8e109e20c5a React-RCTAnimation: ccf3ef00101ea74bda73a045d79a658b36728a60 @@ -632,4 +638,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: c63b686a08336fbad705bcda149d6478884e7332 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/packages/restapi/CHANGELOG.md b/packages/restapi/CHANGELOG.md index 7856279ae..393b1c1be 100644 --- a/packages/restapi/CHANGELOG.md +++ b/packages/restapi/CHANGELOG.md @@ -2,26 +2,530 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). -## [1.4.11](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.10...restapi-1.4.11) (2023-08-18) +## [0.0.1-alpha.44](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.43...restapi-0.0.1-alpha.44) (2023-10-03) ### Bug Fixes -* merge main ([f53a5e2](https://github.com/ethereum-push-notification-service/push-sdk/commit/f53a5e279e3780566b4e2a9242b3555ef50fb4a6)) +* log removed ([68b38e9](https://github.com/ethereum-push-notification-service/push-sdk/commit/68b38e91a1afacb21baa0ee29f8967d86ce4b7f7)) +* minor fix ([c73b6cc](https://github.com/ethereum-push-notification-service/push-sdk/commit/c73b6ccfb510dfc38150a4207f806ccee7b44efb)) -## [1.4.10](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.9...restapi-1.4.10) (2023-08-18) +## [0.0.1-alpha.43](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.42...restapi-0.0.1-alpha.43) (2023-09-29) ### Bug Fixes -* add meta ([#643](https://github.com/ethereum-push-notification-service/push-sdk/issues/643)) ([06689e7](https://github.com/ethereum-push-notification-service/push-sdk/commit/06689e75b58dc93981302b7a5feff28f8486cb85)) -* added decryptedPGPPrivateKey in the returned response for client ([#650](https://github.com/ethereum-push-notification-service/push-sdk/issues/650)) ([16646b4](https://github.com/ethereum-push-notification-service/push-sdk/commit/16646b4e2f6792c2fb30c5e544012244e5b5a6fe)) +* Merge branch 'alpha' into alpha-deployment ([0bf9a2d](https://github.com/ethereum-push-notification-service/push-sdk/commit/0bf9a2d6e0e8ff19af34e5e53ee6e05f35bc0479)) + + + +## [0.0.1-alpha.42](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.41...restapi-0.0.1-alpha.42) (2023-09-29) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([6c3b91d](https://github.com/ethereum-push-notification-service/push-sdk/commit/6c3b91d79622e695808e38afb1e5dbdccab2f3eb)) + + + +## [0.0.1-alpha.41](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.40...restapi-0.0.1-alpha.41) (2023-09-29) + + +### Bug Fixes + +* minor fixes ([4338d18](https://github.com/ethereum-push-notification-service/push-sdk/commit/4338d18e07dbb51245331547442014eff2b54707)) + + + +## [0.0.1-alpha.40](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.39...restapi-0.0.1-alpha.40) (2023-09-29) + + +### Bug Fixes + +* minor fixes ([be3e90a](https://github.com/ethereum-push-notification-service/push-sdk/commit/be3e90ae43625eac56cc82548e150a6296a09777)) +* socket enabled ([fa4fc0a](https://github.com/ethereum-push-notification-service/push-sdk/commit/fa4fc0ae78898432232031df85a1ec04cc9027c8)) + + + +## [0.0.1-alpha.39](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.38...restapi-0.0.1-alpha.39) (2023-09-29) + + +### Bug Fixes + +* more fixes ([fe0ad48](https://github.com/ethereum-push-notification-service/push-sdk/commit/fe0ad486338d1cc57508e5ccc1c3b2aeece9624a)) + + + +## [0.0.1-alpha.38](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.37...restapi-0.0.1-alpha.38) (2023-09-29) + + +### Bug Fixes + +* error handling in socket events ([399d1fe](https://github.com/ethereum-push-notification-service/push-sdk/commit/399d1fe396ce19f764c9fc80dea3a3852216837a)) + + + +## [0.0.1-alpha.37](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.36...restapi-0.0.1-alpha.37) (2023-09-29) + + +### Bug Fixes + +* minor fixes ([12e3ca5](https://github.com/ethereum-push-notification-service/push-sdk/commit/12e3ca542aa11f7640ba5b84492707eb6e8bc3fc)) + + + +## [0.0.1-alpha.36](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.35...restapi-0.0.1-alpha.36) (2023-09-29) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([c4d2cff](https://github.com/ethereum-push-notification-service/push-sdk/commit/c4d2cff0d7ecf909ab9dd993f54ffa9f4ce9d7b4)) +* some changes on stream ([92a2202](https://github.com/ethereum-push-notification-service/push-sdk/commit/92a220264e15dad6636b1e7a34ca6f0871849b14)) +* stream cases ([3ca0496](https://github.com/ethereum-push-notification-service/push-sdk/commit/3ca0496396a9796568973376ee99e26b65f1abed)) + + + +## [0.0.1-alpha.35](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.34...restapi-0.0.1-alpha.35) (2023-09-29) + + +### Bug Fixes + +* added chat.decrypt ([#726](https://github.com/ethereum-push-notification-service/push-sdk/issues/726)) ([995042b](https://github.com/ethereum-push-notification-service/push-sdk/commit/995042b789b19d487b5e2953463cae60e75199b8)) +* error fixed ([99163b3](https://github.com/ethereum-push-notification-service/push-sdk/commit/99163b3338940dd9904630007868ca01faf4190c)) +* Merge branch 'alpha' into alpha-deployment ([be03539](https://github.com/ethereum-push-notification-service/push-sdk/commit/be035393a90a50ac2b9115b8f0a817a988f395f9)) +* Merge branch 'alpha' into alpha-deployment ([8d56ee8](https://github.com/ethereum-push-notification-service/push-sdk/commit/8d56ee882719a65391e7e51abfb0b7f86c2ae5ad)) +* Merge branch 'main' into alpha ([b6887db](https://github.com/ethereum-push-notification-service/push-sdk/commit/b6887db0aa76126a47efa6ec88fc9841d7c3ae06)) +* remove only from test ([09524c7](https://github.com/ethereum-push-notification-service/push-sdk/commit/09524c793ecdef095f90c54bc5895ca1c6adba01)) + + + +## [0.0.1-alpha.35](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.34...restapi-0.0.1-alpha.35) (2023-09-28) + + +### Bug Fixes + +* added chat.decrypt ([#726](https://github.com/ethereum-push-notification-service/push-sdk/issues/726)) ([995042b](https://github.com/ethereum-push-notification-service/push-sdk/commit/995042b789b19d487b5e2953463cae60e75199b8)) +* error fixed ([99163b3](https://github.com/ethereum-push-notification-service/push-sdk/commit/99163b3338940dd9904630007868ca01faf4190c)) +* Merge branch 'alpha' into alpha-deployment ([be03539](https://github.com/ethereum-push-notification-service/push-sdk/commit/be035393a90a50ac2b9115b8f0a817a988f395f9)) +* Merge branch 'alpha' into alpha-deployment ([8d56ee8](https://github.com/ethereum-push-notification-service/push-sdk/commit/8d56ee882719a65391e7e51abfb0b7f86c2ae5ad)) +* Merge branch 'main' into alpha ([b6887db](https://github.com/ethereum-push-notification-service/push-sdk/commit/b6887db0aa76126a47efa6ec88fc9841d7c3ae06)) +* remove only from test ([09524c7](https://github.com/ethereum-push-notification-service/push-sdk/commit/09524c793ecdef095f90c54bc5895ca1c6adba01)) + + + +## [0.0.1-alpha.34](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.33...restapi-0.0.1-alpha.34) (2023-09-27) + + +### Bug Fixes + +* added class based implementation for notification ([#699](https://github.com/ethereum-push-notification-service/push-sdk/issues/699)) ([44f0b7b](https://github.com/ethereum-push-notification-service/push-sdk/commit/44f0b7be1fb568c90c4dfebb7dc61ab82efaddc2)) +* changed typescript 5.0.2 and configured eslint ([8ca7e42](https://github.com/ethereum-push-notification-service/push-sdk/commit/8ca7e4203bcc06886dfe293f8aec5597aec60e5b)) + + + +## [0.0.1-alpha.33](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.19...restapi-0.0.1-alpha.33) (2023-09-07) + + +### Bug Fixes + +* merge alpha ([1783d45](https://github.com/ethereum-push-notification-service/push-sdk/commit/1783d45bb3ceab1cce3c6bb19dfbda38c3662a3e)) +* Merge branch 'alpha' into alpha-deployment ([84aaadf](https://github.com/ethereum-push-notification-service/push-sdk/commit/84aaadfb19e335e5806086fba2ad5e94c1bf3b7e)) +* merge main ([5f37942](https://github.com/ethereum-push-notification-service/push-sdk/commit/5f379427e8a517089758de776eab9f2409aa61f8)) +* merge main ([44e0d32](https://github.com/ethereum-push-notification-service/push-sdk/commit/44e0d324af1d4605129a5e129d3ab6481313c00c)) +* merge main ([9efdbe8](https://github.com/ethereum-push-notification-service/push-sdk/commit/9efdbe8c6f86eeb859075af493797575728cf902)) +* merge main ([93e3106](https://github.com/ethereum-push-notification-service/push-sdk/commit/93e31068bc48e9a271c376d2610e503f69499f8b)) + + + +## [0.0.1-alpha.32](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.31...restapi-0.0.1-alpha.32) (2023-08-17) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([8dd925c](https://github.com/ethereum-push-notification-service/push-sdk/commit/8dd925cd5e0a134e07735b5a3ef7382f4b1909de)) +* Read me fixes ([7c02c3a](https://github.com/ethereum-push-notification-service/push-sdk/commit/7c02c3adef593b59bde6c8dd4d23b760e99a5416)) +* Space rules ([2181074](https://github.com/ethereum-push-notification-service/push-sdk/commit/2181074811549a0c70aea189bc82a1acf1944ba1)) + + + +## [0.0.1-alpha.31](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.30...restapi-0.0.1-alpha.31) (2023-08-16) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([a4c170e](https://github.com/ethereum-push-notification-service/push-sdk/commit/a4c170edd7766c843412bd83f6ef7e5a9ab70247)) + + + +## [0.0.1-alpha.30](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.9...restapi-0.0.1-alpha.30) (2023-08-15) + + +### Bug Fixes + +* fixed subscribe and unsubscribe ([3f908a0](https://github.com/ethereum-push-notification-service/push-sdk/commit/3f908a02ce7faee703340e17f6441f3ebe88fd58)) +* Merge branch 'alpha' into alpha-deployment ([984a80f](https://github.com/ethereum-push-notification-service/push-sdk/commit/984a80f178abc220a0243a5fce00413d4dd0aadb)) +* merge main ([f338fd4](https://github.com/ethereum-push-notification-service/push-sdk/commit/f338fd49707933c65bdcc7736cdd08d6784625ba)) +* **merged:** merged ([bb71789](https://github.com/ethereum-push-notification-service/push-sdk/commit/bb717897cec1e7d46d86be05b1d29ca9103272c5)) + + + +## [0.0.1-alpha.29](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.28...restapi-0.0.1-alpha.29) (2023-08-02) + + +### Bug Fixes + +* url correction ([26b6b73](https://github.com/ethereum-push-notification-service/push-sdk/commit/26b6b739d8b6b8a38ae10ae87270ca4d8782db51)) + + + +## [0.0.1-alpha.28](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.4...restapi-0.0.1-alpha.28) (2023-08-02) + + +### Bug Fixes + +* add: scw sig verification ([#593](https://github.com/ethereum-push-notification-service/push-sdk/issues/593)) ([6768065](https://github.com/ethereum-push-notification-service/push-sdk/commit/67680657981a847e23a4dbad6d2fd6a7bc127743)) +* Merge branch 'alpha' into alpha-deployment ([6c19940](https://github.com/ethereum-push-notification-service/push-sdk/commit/6c19940b4d72d9443b8afd06ddc2a6f9e29582a7)) +* merged main ([c5533f8](https://github.com/ethereum-push-notification-service/push-sdk/commit/c5533f8dce7b88cb1f14aa72f83579a8e01dcf36)) + + + +## [0.0.1-alpha.27](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.3...restapi-0.0.1-alpha.27) (2023-07-24) + + +### Bug Fixes + +* merge alpha ([16a55af](https://github.com/ethereum-push-notification-service/push-sdk/commit/16a55af713da0394ab9d82e13fed6d64190b247d)) +* Merge branch 'alpha' into alpha-deployment ([6ea669a](https://github.com/ethereum-push-notification-service/push-sdk/commit/6ea669a5aa3cebe693de259c1ea28787c0407d2a)) +* signer compatibility with viem ([3df201c](https://github.com/ethereum-push-notification-service/push-sdk/commit/3df201c7474b88d270d6e868bc516f223539e74c)) + + + +## [0.0.1-alpha.26](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.2...restapi-0.0.1-alpha.26) (2023-07-21) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([3f3369a](https://github.com/ethereum-push-notification-service/push-sdk/commit/3f3369a1bda71a82cde8ef386901265a62a91a2c)) +* merge main ([c07ce16](https://github.com/ethereum-push-notification-service/push-sdk/commit/c07ce1628321dd3bae46d08e08bfc7986795bb64)) +* signer compatibility with viem and ethers ([1edea43](https://github.com/ethereum-push-notification-service/push-sdk/commit/1edea431ccf7f19cc0430deb2ce7a5c61390d99f)) +* signer compatibility with viem and ethers ([#567](https://github.com/ethereum-push-notification-service/push-sdk/issues/567)) ([c07c3fa](https://github.com/ethereum-push-notification-service/push-sdk/commit/c07c3fab76a095998b1eac830c941116ad1e9b4f)) +* space feed API path fix ([00d91b1](https://github.com/ethereum-push-notification-service/push-sdk/commit/00d91b1860525c15618f130970c9173100424a23)) +* use SpaceIFeeds ([5b7f2fc](https://github.com/ethereum-push-notification-service/push-sdk/commit/5b7f2fc2398a2203925059aa2721e855ea9f98d4)) + + + +## [0.0.1-alpha.25](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.1...restapi-0.0.1-alpha.25) (2023-07-19) + + +### Bug Fixes + +* fixed merge conflicts ([dfab492](https://github.com/ethereum-push-notification-service/push-sdk/commit/dfab492127e821219c5fd5dc08ed08a172bee31b)) +* Merge branch 'alpha' into alpha-deployment ([a71302b](https://github.com/ethereum-push-notification-service/push-sdk/commit/a71302b4a5066cb9d00ca5d14e55228c558eda85)) +* Merge branch 'main' into alpha-deployment ([fe93d43](https://github.com/ethereum-push-notification-service/push-sdk/commit/fe93d43a103d5067b16d8f7a5d01835be1d1f40a)) +* renamed spaces variables and removed some unused variables ([3519d39](https://github.com/ethereum-push-notification-service/push-sdk/commit/3519d3982be389711f48891896478b7a35a71b73)) +* space api ([064e10d](https://github.com/ethereum-push-notification-service/push-sdk/commit/064e10d9c66ab1d39f799fd64a39652862b2f074)) + + + +## [0.0.1-alpha.24](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.23...restapi-0.0.1-alpha.24) (2023-07-14) + + +### Bug Fixes + +* rename chats to spaces ([899eb21](https://github.com/ethereum-push-notification-service/push-sdk/commit/899eb212af29e3a65541686d98927e37b97927c5)) + + + +## [0.0.1-alpha.23](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.22...restapi-0.0.1-alpha.23) (2023-07-12) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([b120e30](https://github.com/ethereum-push-notification-service/push-sdk/commit/b120e302f6b9f8e360b43f80dcdd3248c1e4304b)) +* Merge branch 'alpha' into alpha-deployment ([54c5721](https://github.com/ethereum-push-notification-service/push-sdk/commit/54c57219c7f3f198a3f7578a0720895aff2d27f4)) +* Merge branch 'main' into alpha ([7b316ec](https://github.com/ethereum-push-notification-service/push-sdk/commit/7b316ec8e6f3178c02e7fce6d27884ba8ef1b4f4)) +* Merge branch 'main' into alpha ([d66202d](https://github.com/ethereum-push-notification-service/push-sdk/commit/d66202d0798b9ec731d7f5d30031b89ae29d72b4)) + + + +## [0.0.1-alpha.22](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.21...restapi-0.0.1-alpha.22) (2023-07-07) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([5c84e2f](https://github.com/ethereum-push-notification-service/push-sdk/commit/5c84e2f07667fe4e9d94561544807b11c103ac49)) +* merged maain ([942cc65](https://github.com/ethereum-push-notification-service/push-sdk/commit/942cc65a60aa043054cebb143990711fb6e2efdb)) + + + +## [0.0.1-alpha.21](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.20...restapi-0.0.1-alpha.21) (2023-07-07) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([c05d024](https://github.com/ethereum-push-notification-service/push-sdk/commit/c05d024415bb1cb9e1fe59714d7db5516d161c06)) +* merged main ([46cf04e](https://github.com/ethereum-push-notification-service/push-sdk/commit/46cf04e75c314065c77a5a77d9351d9ccc7e0a58)) +* spaces naming ([6db7fc0](https://github.com/ethereum-push-notification-service/push-sdk/commit/6db7fc09b680060f022040feb2a22aeed9c652d0)) + + + +## [0.0.1-alpha.20](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.19...restapi-0.0.1-alpha.20) (2023-07-03) + + +### Bug Fixes + +* new commit ([25f2725](https://github.com/ethereum-push-notification-service/push-sdk/commit/25f2725efb0e1017ee2a0460259b27f252471014)) + + + +## [0.0.1-alpha.19](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.3.9...restapi-0.0.1-alpha.19) (2023-07-03) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([a15e368](https://github.com/ethereum-push-notification-service/push-sdk/commit/a15e368241215e2e2219792afd718567d621bf2a)) +* merge main ([6998d35](https://github.com/ethereum-push-notification-service/push-sdk/commit/6998d35aa181f17a5ad8d9501943a6a867814650)) +* rename based on new convention ([0e34479](https://github.com/ethereum-push-notification-service/push-sdk/commit/0e34479b1581abd59e0f853d6547e23a0afb5e28)) + + + +## [0.0.1-alpha.18](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.3.8...restapi-0.0.1-alpha.18) (2023-06-20) + + +### Bug Fixes + +* add name to SpaceIFeeds ([9c22271](https://github.com/ethereum-push-notification-service/push-sdk/commit/9c222715d0f15ae912b90661f9d18d42bddc4c89)) +* Merge branch 'alpha' into alpha-deployment ([b521522](https://github.com/ethereum-push-notification-service/push-sdk/commit/b521522c3b147b789a03b2683da4b6cefac795fe)) +* Merge branch 'main' into alpha ([64de06f](https://github.com/ethereum-push-notification-service/push-sdk/commit/64de06fc3cfd4359cf0d7fb70212e775ce9e51b9)) +* merge main ([27105a2](https://github.com/ethereum-push-notification-service/push-sdk/commit/27105a247fe4bd4db78a41be06ef6a2d52fb6b21)) +* update path ([10d62b1](https://github.com/ethereum-push-notification-service/push-sdk/commit/10d62b1a017b3d0a5044a4ab33bdce183f795f51)) + + + +## [0.0.1-alpha.17](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.3.5...restapi-0.0.1-alpha.17) (2023-06-08) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([a9d8ff1](https://github.com/ethereum-push-notification-service/push-sdk/commit/a9d8ff18bcad950e40b966e5b4020e29b493aa28)) +* merge main ([78c020a](https://github.com/ethereum-push-notification-service/push-sdk/commit/78c020ac61decc2d3b78d3749c8ec5df7478842f)) +* **video:** fix error on repeated acceptRequest calls ([#442](https://github.com/ethereum-push-notification-service/push-sdk/issues/442)) ([f34bfa0](https://github.com/ethereum-push-notification-service/push-sdk/commit/f34bfa09cf88e812e07c0dcf7fabf792726c577f)) + + + +## [0.0.1-alpha.16](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.3.3...restapi-0.0.1-alpha.16) (2023-06-02) + + +### Bug Fixes + +* add spaces for functions ([#307](https://github.com/ethereum-push-notification-service/push-sdk/issues/307)) ([aea015a](https://github.com/ethereum-push-notification-service/push-sdk/commit/aea015ae478da77ebaa41a4e111ac213027b0b6a)) +* Merge branch 'alpha' into alpha-deployment ([ad6a56b](https://github.com/ethereum-push-notification-service/push-sdk/commit/ad6a56be24c326b7fb1f6eddb01b20b489eee27d)) +* merge main ([3959345](https://github.com/ethereum-push-notification-service/push-sdk/commit/39593456140e152e53f4bd7c10a19e0d8f05dfc9)) + + + +## [0.0.1-alpha.15](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.3.2...restapi-0.0.1-alpha.15) (2023-05-29) + + +### Bug Fixes + +* fix nft videocall ([#411](https://github.com/ethereum-push-notification-service/push-sdk/issues/411)) ([8cdb999](https://github.com/ethereum-push-notification-service/push-sdk/commit/8cdb999bc548caf67ec6fbe625253b5795a4e465)) +* Iuser structure changed ([#365](https://github.com/ethereum-push-notification-service/push-sdk/issues/365)) ([2fc6f54](https://github.com/ethereum-push-notification-service/push-sdk/commit/2fc6f549c80a65a5a6009b0c2fa9635d757bdf11)), closes [#390](https://github.com/ethereum-push-notification-service/push-sdk/issues/390) [#295](https://github.com/ethereum-push-notification-service/push-sdk/issues/295) +* Merge branch 'alpha' into alpha-deployment ([a66c9a4](https://github.com/ethereum-push-notification-service/push-sdk/commit/a66c9a4a3628700a450b8e2fb7a5f942d1d84095)) +* Merge branch 'alpha' into alpha-deployment ([f247665](https://github.com/ethereum-push-notification-service/push-sdk/commit/f2476650b650ade59721c30f6e8483e86c013cd4)) +* merged main to alpha ([067bc5d](https://github.com/ethereum-push-notification-service/push-sdk/commit/067bc5d358c5f218628a980ce23ab3b39615805f)) + + + +## [0.0.1-alpha.13](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.12...restapi-0.0.1-alpha.13) (2023-05-19) + + +### Bug Fixes + +* backward compatiblity fix ([fbf2463](https://github.com/ethereum-push-notification-service/push-sdk/commit/fbf246396a44513626fc1dda6e90c12d2f073ead)) +* Merge branch 'alpha' into alpha-deployment ([3b5a0f1](https://github.com/ethereum-push-notification-service/push-sdk/commit/3b5a0f160b72e775cf17031067fa7488171e1bbd)) + + + +## [0.0.1-alpha.12](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.11...restapi-0.0.1-alpha.12) (2023-05-19) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([963cc02](https://github.com/ethereum-push-notification-service/push-sdk/commit/963cc02768862b6a9427519257ff9f9565f613ea)) +* **video:** fix enableAudio ([85ef733](https://github.com/ethereum-push-notification-service/push-sdk/commit/85ef733127bdfbae5c66c671ddc7700785d192c0)) + + + +## [0.0.1-alpha.11](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.10...restapi-0.0.1-alpha.11) (2023-05-19) + + +### Bug Fixes + +* added enums ([f1880d8](https://github.com/ethereum-push-notification-service/push-sdk/commit/f1880d8f037fc640851af4311bd5e514de5cf3db)) +* changed additionalMeta structure ([#406](https://github.com/ethereum-push-notification-service/push-sdk/issues/406)) ([0cf573e](https://github.com/ethereum-push-notification-service/push-sdk/commit/0cf573e56165bf3164a42cbc4b41a3085801e90a)) +* fix versions ([05c8fa9](https://github.com/ethereum-push-notification-service/push-sdk/commit/05c8fa9f9286e78d706c6be53e7b8ae963105766)) +* Merge branch 'alpha' into alpha-deployment ([68f11eb](https://github.com/ethereum-push-notification-service/push-sdk/commit/68f11eb71d44423081000c00c36cb0a936558f2f)) +* Merge branch 'alpha' into alpha-deployment ([3700515](https://github.com/ethereum-push-notification-service/push-sdk/commit/3700515be010fdcab6062db0a039f7df612a7a6b)) +* Merge branch 'alpha' into alpha-deployment ([925b437](https://github.com/ethereum-push-notification-service/push-sdk/commit/925b4379aa7b7d2d061b23d5ccbc42d06829f100)) +* **sendvideonotifications:** modify additional meta acc to new std ([#407](https://github.com/ethereum-push-notification-service/push-sdk/issues/407)) ([9d2124a](https://github.com/ethereum-push-notification-service/push-sdk/commit/9d2124aa61f798a0b137636aac62397e1e52150e)) +* **types:** remove bad import ([5517200](https://github.com/ethereum-push-notification-service/push-sdk/commit/55172002a2cecb33407a3828c2debeca24e0c972)) +* **video:** remove stop audio/video logic from create function ([#404](https://github.com/ethereum-push-notification-service/push-sdk/issues/404)) ([983c896](https://github.com/ethereum-push-notification-service/push-sdk/commit/983c896a2c89463f117f5a4d8153ef95501f2124)) + + +### Reverts + +* **getverificationproof:** add wallet and env params to getVerificationProof ([#403](https://github.com/ethereum-push-notification-service/push-sdk/issues/403)) ([26f6fcb](https://github.com/ethereum-push-notification-service/push-sdk/commit/26f6fcb9b2992850cd33ea613cea13830bd48bc3)) + + + +## [0.0.1-alpha.10](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.9...restapi-0.0.1-alpha.10) (2023-05-17) + + +### Bug Fixes + +* added deprecated info to history ([#399](https://github.com/ethereum-push-notification-service/push-sdk/issues/399)) ([eda1a34](https://github.com/ethereum-push-notification-service/push-sdk/commit/eda1a345975141c5656891dbf919aacd2924d66b)) +* Merge branch 'alpha' into alpha-deployment ([46ebed2](https://github.com/ethereum-push-notification-service/push-sdk/commit/46ebed2b9d4b4ff0518429a091d0a37b1d3f022d)) + + + +## [0.0.1-alpha.9](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.8...restapi-0.0.1-alpha.9) (2023-05-16) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([469398d](https://github.com/ethereum-push-notification-service/push-sdk/commit/469398dc94df805257d6a6bb8e0707cebc5f7d8a)) +* **video:** turn off trickle while creating peer instance ([#398](https://github.com/ethereum-push-notification-service/push-sdk/issues/398)) ([ae5b38e](https://github.com/ethereum-push-notification-service/push-sdk/commit/ae5b38e702539eaf92a516b4e557c5a88de0f4c7)) + + + +## [0.0.1-alpha.8](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.7...restapi-0.0.1-alpha.8) (2023-05-16) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([549fd83](https://github.com/ethereum-push-notification-service/push-sdk/commit/549fd839867d84a98a10206a7f9945aeb1720e49)) +* Merge branch 'main' into alpha ([72464fd](https://github.com/ethereum-push-notification-service/push-sdk/commit/72464fd97260b612649035e3b241f946de8f9e92)) +* **video:** set trickle to true while creating peer instance ([#397](https://github.com/ethereum-push-notification-service/push-sdk/issues/397)) ([0b609be](https://github.com/ethereum-push-notification-service/push-sdk/commit/0b609bec87a6187d1e7cbf8052a2b9a36b9fcd7a)) + + + +## [0.0.1-alpha.7](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.6...restapi-0.0.1-alpha.7) (2023-05-15) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([37c1c8d](https://github.com/ethereum-push-notification-service/push-sdk/commit/37c1c8db579876f5835c2e5bb5e6baf073dc9208)) +* **video:** remove status change upon connect in request ([#394](https://github.com/ethereum-push-notification-service/push-sdk/issues/394)) ([7441ef0](https://github.com/ethereum-push-notification-service/push-sdk/commit/7441ef0fb2c9ed39e12a4f1819ade0ee7e0d6b10)) + + + +## [0.0.1-alpha.6](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.5...restapi-0.0.1-alpha.6) (2023-05-14) + + +### Bug Fixes + +* add video call retry logic upon error & doc: add video call in restapi/readme ([#391](https://github.com/ethereum-push-notification-service/push-sdk/issues/391)) ([9c8c86b](https://github.com/ethereum-push-notification-service/push-sdk/commit/9c8c86b35d1cb0300d0170e87931dd31a15f9342)) + + + +## [0.0.1-alpha.5](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.4...restapi-0.0.1-alpha.5) (2023-05-14) + + + +## [0.0.1-alpha.4](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.2.15...restapi-0.0.1-alpha.4) (2023-05-12) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([a1a8666](https://github.com/ethereum-push-notification-service/push-sdk/commit/a1a86661b1823c84328ec90ac9aafc6c57f574f3)) +* Merge branch 'main' into alpha ([5fc51db](https://github.com/ethereum-push-notification-service/push-sdk/commit/5fc51db1a336203048b4b42a5384cb37cf79c509)) +* **video:** separate react state from video class instance variable data ([#389](https://github.com/ethereum-push-notification-service/push-sdk/issues/389)) ([83bf445](https://github.com/ethereum-push-notification-service/push-sdk/commit/83bf4457332b127bf9e41a2f4c93fb851367724d)) + + + +## [0.0.1-alpha.3](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.2...restapi-0.0.1-alpha.3) (2023-05-11) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([e19b9b0](https://github.com/ethereum-push-notification-service/push-sdk/commit/e19b9b05b60174e68dc7bfe0e2349e20d8af2604)) +* Replace arrow functions with normal functions in the Video class ([#380](https://github.com/ethereum-push-notification-service/push-sdk/issues/380)) ([b90435a](https://github.com/ethereum-push-notification-service/push-sdk/commit/b90435a953b908899c92eb5b4d4c3677e47b1552)) + + + +## [0.0.1-alpha.2](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.2.13...restapi-0.0.1-alpha.2) (2023-05-10) + + +### Bug Fixes + +* merge alpha ([7f0642c](https://github.com/ethereum-push-notification-service/push-sdk/commit/7f0642c4c417390a5bb52d36d9493bd5b767b634)) +* merge main ([a5fdfe1](https://github.com/ethereum-push-notification-service/push-sdk/commit/a5fdfe10f18c857c32aa5fe5c5dd95db0f268cd1)) +* merge main to alpha ([4866a37](https://github.com/ethereum-push-notification-service/push-sdk/commit/4866a37ed0502c0d16ac91f088d3bb5e597b652a)) + + + +## [0.0.1-alpha.1](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.0...restapi-0.0.1-alpha.1) (2023-05-08) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([1223c60](https://github.com/ethereum-push-notification-service/push-sdk/commit/1223c60b0f179b26537992a776155aefffd7b5ef)) +* sendVideoNotification and end video call logic ([#367](https://github.com/ethereum-push-notification-service/push-sdk/issues/367)) ([d39c703](https://github.com/ethereum-push-notification-service/push-sdk/commit/d39c703bcda6d332717a5e9b1af6ab574be9d991)) + + + +## [0.0.1-alpha.0](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-beta.2...restapi-0.0.1-alpha.0) (2023-05-04) + + +### Bug Fixes + +* added pagination and deprecation tag ([#346](https://github.com/ethereum-push-notification-service/push-sdk/issues/346)) ([69763b8](https://github.com/ethereum-push-notification-service/push-sdk/commit/69763b8da2cf3e92bb85908e4f46a72b650c9dba)) +* changed Definitions for auth.update and upgrade ([#351](https://github.com/ethereum-push-notification-service/push-sdk/issues/351)) ([31daee3](https://github.com/ethereum-push-notification-service/push-sdk/commit/31daee3a5aa913705d1dec8210c0412cd89c94c9)) +* eip191v2 signatures for create and auth.update ([#353](https://github.com/ethereum-push-notification-service/push-sdk/issues/353)) ([008e6d0](https://github.com/ethereum-push-notification-service/push-sdk/commit/008e6d08d75fdacf19f1674cc2b8bd82091fa31f)) +* Merge branch 'main' into alpha ([477bae4](https://github.com/ethereum-push-notification-service/push-sdk/commit/477bae4fdc4e86374615f0f67c41c570a567b9fe)) + + + +## [0.0.1-alpha.32](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.31...restapi-0.0.1-alpha.32) (2023-08-17) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([8dd925c](https://github.com/ethereum-push-notification-service/push-sdk/commit/8dd925cd5e0a134e07735b5a3ef7382f4b1909de)) +* Read me fixes ([7c02c3a](https://github.com/ethereum-push-notification-service/push-sdk/commit/7c02c3adef593b59bde6c8dd4d23b760e99a5416)) +* Space rules ([2181074](https://github.com/ethereum-push-notification-service/push-sdk/commit/2181074811549a0c70aea189bc82a1acf1944ba1)) + + + +## [0.0.1-alpha.31](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.30...restapi-0.0.1-alpha.31) (2023-08-16) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([a4c170e](https://github.com/ethereum-push-notification-service/push-sdk/commit/a4c170edd7766c843412bd83f6ef7e5a9ab70247)) + + + +## [0.0.1-alpha.30](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.29...restapi-0.0.1-alpha.30) (2023-08-15) + + +### Bug Fixes + +* added Reaction MessageType ([#633](https://github.com/ethereum-push-notification-service/push-sdk/issues/633)) ([2856ece](https://github.com/ethereum-push-notification-service/push-sdk/commit/2856ece83e0a42335ff7e5e2f8db83d2aa7fd007)) +* allow to create empty groups just with group creator. ([#607](https://github.com/ethereum-push-notification-service/push-sdk/issues/607)) ([7d14e24](https://github.com/ethereum-push-notification-service/push-sdk/commit/7d14e248626422cf079e4b99dbdfa3ce6cd796da)) +* CreateUserPropsWithProfile ([#612](https://github.com/ethereum-push-notification-service/push-sdk/issues/612)) ([32125b5](https://github.com/ethereum-push-notification-service/push-sdk/commit/32125b5408b45e8a51ba9a16acc1250fc56decae)) +* deprecation notice ([#581](https://github.com/ethereum-push-notification-service/push-sdk/issues/581)) ([6cd4b1e](https://github.com/ethereum-push-notification-service/push-sdk/commit/6cd4b1ea8626849a5f78588a21ac66db2bd293df)) +* fixed subscribe and unsubscribe ([3f908a0](https://github.com/ethereum-push-notification-service/push-sdk/commit/3f908a02ce7faee703340e17f6441f3ebe88fd58)) +* Merge branch 'alpha' into alpha-deployment ([984a80f](https://github.com/ethereum-push-notification-service/push-sdk/commit/984a80f178abc220a0243a5fce00413d4dd0aadb)) +* merge main ([f338fd4](https://github.com/ethereum-push-notification-service/push-sdk/commit/f338fd49707933c65bdcc7736cdd08d6784625ba)) +* **merged:** merged ([bb71789](https://github.com/ethereum-push-notification-service/push-sdk/commit/bb717897cec1e7d46d86be05b1d29ca9103272c5)) +* **sdk-frontend:** comment out spaces UI to remove build issues ([#618](https://github.com/ethereum-push-notification-service/push-sdk/issues/618)) ([769c20d](https://github.com/ethereum-push-notification-service/push-sdk/commit/769c20d5eb42b758277e57699793b8e76deeab94)) -## [1.4.9](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-1.4.8...restapi-1.4.9) (2023-08-11) ## [0.0.1-alpha.29](https://github.com/ethereum-push-notification-service/push-sdk/compare/restapi-0.0.1-alpha.28...restapi-0.0.1-alpha.29) (2023-08-02) diff --git a/packages/restapi/PushChatLowLevelAPI.md b/packages/restapi/PushChatLowLevelAPI.md index 1cd735442..5ead9ebde 100644 --- a/packages/restapi/PushChatLowLevelAPI.md +++ b/packages/restapi/PushChatLowLevelAPI.md @@ -1681,7 +1681,7 @@ const response = await PushAPI.chat.createGroup({ groupImage: <group image link> , admins: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], rules: { - 'groupAccess': { + 'entry': { 'conditions': [ { 'any': [ @@ -1717,7 +1717,7 @@ const response = await PushAPI.chat.createGroup({ } ] }, - 'chatAccess': { + 'chat': { 'conditions': [ { 'all': [ @@ -1803,10 +1803,10 @@ export type Condition = ConditionBase & { }; export interface Rules { - groupAccess?: { + entry?: { conditions: Array<Condition | ConditionBase>; }; - chatAccess?: { + chat?: { conditions: Array<Condition | ConditionBase>; }; } @@ -1814,7 +1814,7 @@ export interface Rules { #### Rules Object Description -The rules object consists of two main sections: `groupAccess` and `chatAccess`, both of which contain conditions to manage access and permissions within a chat application. These conditions may involve different criteria related to token holdings or guild membership. +The rules object consists of two main sections: `entry` and `chat`, both of which contain conditions to manage access and permissions within a chat application. These conditions may involve different criteria related to token holdings or guild membership. #### Conditions @@ -1995,7 +1995,7 @@ This structure governs user permissions within a guild. The subcategory dictates groupCreator: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', chatId: '0364908cbaef95a5a3124c394ada868177c158a4d677cedd6fd1e42db1852386', rules: { - 'groupAccess': { + 'entry': { 'conditions': [ { 'any': [ @@ -2030,7 +2030,7 @@ This structure governs user permissions within a guild. The subcategory dictates } ] }, - 'chatAccess': { + 'chat': { 'conditions': [ { 'all': [ @@ -2100,10 +2100,10 @@ Allowed Options (params with \_ are mandatory) ```typescript // PushAPI_chat_getGroupAccess | Response - 200 OK { - 'groupAccess': true, - 'chatAccess': false, + 'entry': true, + 'chat': false, 'rules': { - 'groupAccess': { + 'entry': { 'conditions': [ { 'any': [ @@ -2142,7 +2142,7 @@ Allowed Options (params with \_ are mandatory) } ] }, - 'chatAccess': { + 'chat': { 'conditions': [ { 'all': [ @@ -2227,7 +2227,7 @@ const response = await PushAPI.chat.updateGroup({ groupImage: <group image link> , admins: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], rules: { - 'groupAccess': { + 'entry': { 'conditions': [ { 'any': [ @@ -2254,7 +2254,7 @@ const response = await PushAPI.chat.updateGroup({ } ] }, - 'chatAccess': { + 'chat': { 'conditions': [ { 'all': [ @@ -2431,7 +2431,7 @@ Allowed Options (params with _ are mandatory) groupCreator: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', chatId: '870cbb20f0b116d5e461a154dc723dc1485976e97f61a673259698aa7f48371c', rules: { - 'groupAccess': { + 'entry': { 'conditions': [ { 'any': [ @@ -2458,7 +2458,7 @@ Allowed Options (params with _ are mandatory) } ] }, - 'chatAccess': { + 'chat': { 'conditions': [ { 'all': [ diff --git a/packages/restapi/PushNotificationLowLevelAPI.md b/packages/restapi/PushNotificationLowLevelAPI.md new file mode 100644 index 000000000..dccc871a4 --- /dev/null +++ b/packages/restapi/PushNotificationLowLevelAPI.md @@ -0,0 +1,1490 @@ +# PushNotificationLowLevelAPI + +This file documents the usage of Low Level Push Notification Functions. Visit [Developer Docs](https://docs.push.org/developers) or [Push.org](https://push.org) to learn more. + +# Index +- [PushNotificationLowLevelAPI](#pushnotificationlowlevelapi) +- [Index](#index) + - [For Notification](#for-notification) + - [Fetching user notifications](#fetching-user-notifications) + - [Fetching user spam notifications](#fetching-user-spam-notifications) + - [Fetching user subscriptions](#fetching-user-subscriptions) + - [Fetching channel details](#fetching-channel-details) + - [Searching for channel(s)](#searching-for-channels) + - [Opt in to a channel](#opt-in-to-a-channel) + - [Opt out to a channel](#opt-out-to-a-channel) + - [Sending notification](#sending-notification) + - [Direct payload for single recipient(target)](#direct-payload-for-single-recipienttarget) + - [Direct payload for group of recipients(subset)](#direct-payload-for-group-of-recipientssubset) + - [Direct payload for all recipients(broadcast)](#direct-payload-for-all-recipientsbroadcast) + - [IPFS payload for single recipient(target)](#ipfs-payload-for-single-recipienttarget) + - [IPFS payload for group of recipients(subset)](#ipfs-payload-for-group-of-recipientssubset) + - [IPFS payload for all recipients(broadcast)](#ipfs-payload-for-all-recipientsbroadcast) + - [Minimal payload for single recipient(target)](#minimal-payload-for-single-recipienttarget) + - [Minimal payload for a group of recipient(subset)](#minimal-payload-for-a-group-of-recipientsubset) + - [Minimal payload for all recipients(broadcast)](#minimal-payload-for-all-recipientsbroadcast) + - [Graph payload for single recipient(target)](#graph-payload-for-single-recipienttarget) + - [Graph payload for group of recipients(subset)](#graph-payload-for-group-of-recipientssubset) + - [Graph payload for all recipients(broadcast)](#graph-payload-for-all-recipientsbroadcast) + - [Notification Helper Utils](#notification-helper-utils) + - [Parsing notifications](#parsing-notifications) + - [Advanced Notifications (WIP)](#advanced-notifications-wip) + - [DEPRECATED](#deprecated) + - [Get a channel's subscriber list of addresses](#get-a-channels-subscriber-list-of-addresses) + + +## For Notification + +### **Fetching user notifications** + +```typescript +const notifications = await PushAPI.user.getFeeds({ + user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP + env: 'staging', +}); +``` + +<details> + <summary><b>Expected response (Fetching user notifications)</b></summary> + +```typescript +// PushAPI.user.getFeeds | Response - 200 OK +[ + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-32: Add Euler staking PYT wrappers for AA tranche to IdleDAI\n' + + '[timestamp:1676570405.922][timestamp: 1676570405]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '3401597', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', + }, + secret: '', + }, + { + cta: '', + title: '', + message: 'hi socket', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '2491520', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hi socket', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'hiii', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '2490919', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hiii', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'Hey -testing', + icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + url: 'https://gnosis.io', + sid: '2429211', + app: 'Gnosis', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'Hey -testing', title: 'Gnosis - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'Hey', + icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + url: 'https://gnosis.io', + sid: '2429210', + app: 'Gnosis', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'Hey', title: 'Gnosis - ' }, + secret: '', + }, + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-31: Add AA Euler staking PYT wrappers to IdleUSDT, IdleUSDC and IdleWETH. Gauges rate to 0. Extend LM. \n' + + '[timestamp:1674583206.258][timestamp: 1674583206]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '1784234', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', + }, + secret: '', + }, + { + cta: '', + title: '', + message: 'hi 2023', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '1132231', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hi 2023', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'hi', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '1132230', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hi', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-30: Remove idleDAI wrapper for cpFOL-USDC (DAI) senior. Same for idleUSDC with cpWIN-USDC. Remove idleRAI, idleSUSD, idleTUSD and idleFEI from IdleController. Update voting delay in Governor \n' + + ' \n' + + '[timestamp:1672769747.911][timestamp: 1672769747]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '1080072', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', + }, + secret: '', + }, + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-29: Remove idleDAI wrapper for cpFOL-USDC (DAI) senior. Same for idleUSDC with cpWIN-USDC. Remove idleRAI, idleSUSD, idleTUSD and idleFEI from IdleController. Update voting delay in Governor \n' + + ' \n' + + '[timestamp:1671624005.155][timestamp: 1671624005]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '935285', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', + }, + secret: '', + }, +]; +``` + +</details> + +--- + +### **Fetching user spam notifications** + +```typescript +const spams = await PushAPI.user.getFeeds({ + user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP + spam: true, + env: 'staging', +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| user_ | string | - | user account address (CAIP) | +| page | number | 1 | page index of the results | +| limit | number | 10 | number of items in 1 page | +| spam | boolean | false | if "true" it will fetch spam feeds | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| raw | boolean | false | if "true" the method will return unformatted raw API response| + +<details> + <summary><b>Expected response (Fetching user spam notifications)</b></summary> + +```typescript +PushAPI.user.getFeeds [Spam] | Response - 200 OK +[ + { + cta: 'https://goerli.etherscan.io/tx/0xe1d230d2139b0d726d5a80713ac437bed3b55b808eb651d85d8b86a377b56aa3', + title: 'PUSH Tokens Received', + message: 'Received 500 PUSH from 0x69e666767ba3a661369e1e2f572ede7adc926029', + icon: 'https://gateway.ipfs.io/ipfs/bafybeih7t3hftdcfz6axqvcnszou6tfo6blrlmis3cns33jad7dqhdcjpi/Qmah3yyjjcQGtkHDRkyrs4VoXsrgyr9SqEsLekLPW2nhpb', + url: 'https://uniswap.org', + sid: '3436148', + app: 'Uniswap Test', + image: 'https://play-lh.googleusercontent.com/i911_wMmFilaAAOTLvlQJZMXoxBF34BMSzRmascHezvurtslYUgOHamxgEnMXTklsF-S', + blockchain: 'THE_GRAPH', + notification: { + body: 'Received 500 PUSH from 0x69e666767ba3a661369e1e2f572ede7adc926029', + title: 'Uniswap Test - PUSH Tokens Received' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title', + message: 'sample msg body', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihvggzdcvfbjw4bqytpbldeauc7chru3mj62wz4af7lezqvuyxj6i/QmW8vCUVk43gtm8CzAqKBUR13HK4fiaFHk7EfEnJYSonZw', + url: 'https://stream-2-earn.vercel.app/', + sid: '3258266', + app: 'Stream2Earn', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY', + title: 'Stream2Earn - [SDK-TEST] notification TITLE:' + }, + secret: '' + }, + { + cta: 'https://goerli.etherscan.io/tx/0xc4a01fd9ac033b5e00b45ad52af51821add8db4f31cae93e19326aff01b4e9c7', + title: 'PUSH Tokens Received', + message: 'Received 50 PUSH from 0x7b9e036bd304fd1bea0523de718038bbe345521a', + icon: 'https://gateway.ipfs.io/ipfs/bafybeih7t3hftdcfz6axqvcnszou6tfo6blrlmis3cns33jad7dqhdcjpi/Qmah3yyjjcQGtkHDRkyrs4VoXsrgyr9SqEsLekLPW2nhpb', + url: 'https://uniswap.org', + sid: '2868333', + app: 'Uniswap Test', + image: 'https://play-lh.googleusercontent.com/i911_wMmFilaAAOTLvlQJZMXoxBF34BMSzRmascHezvurtslYUgOHamxgEnMXTklsF-S', + blockchain: 'THE_GRAPH', + notification: { + body: 'Received 50 PUSH from 0x7b9e036bd304fd1bea0523de718038bbe345521a', + title: 'Uniswap Test - PUSH Tokens Received' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title 1675241933583', + message: 'type:3 identity:2', + icon: 'na', + url: 'https://app.push.org', + sid: '2427470', + app: 'internal', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1675241933583', + title: 'internal - [SDK-TEST] notification TITLE: 16752419' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title 1673154212899', + message: 'type:3 identity:2', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihffthqhvxdt73pe4voisz63mm2fydnrctypmh5byaglujjejjvzm/QmcHvKxoCDgN7mH2sMzFkoqDaRLUWdNMa2FbJbGRVkdF3d', + url: 'https://www.google.com', + sid: '1178703', + app: 'Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1673154212899', + title: 'Test Channel - [SDK-TEST] notification TITLE: 1673' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title 1673154141751', + message: 'type:3 identity:2', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihffthqhvxdt73pe4voisz63mm2fydnrctypmh5byaglujjejjvzm/QmcHvKxoCDgN7mH2sMzFkoqDaRLUWdNMa2FbJbGRVkdF3d', + url: 'https://www.google.com', + sid: '1178702', + app: 'Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1673154141751', + title: 'Test Channel - [SDK-TEST] notification TITLE: 1673' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title 1669794606748', + message: 'type:4 identity:2', + icon: 'https://gateway.ipfs.io/ipfs/bafybeih4qfevv2ms3tzognoscd5r5kenjcjjzvkzb6w6jctzcjzqoaxite/Qma13kPK6pcv8Z4Xjjw1MULfXgHxXPafp5Fqm1D9b5UXuv', + url: 'https://google.com', + sid: '839794', + app: 'asdf', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1669794606748', + title: 'asdf - [SDK-TEST] notification TITLE: 166979460674' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title 1669794334167', + message: 'type:4 identity:2', + icon: 'https://gateway.ipfs.io/ipfs/bafybeih4qfevv2ms3tzognoscd5r5kenjcjjzvkzb6w6jctzcjzqoaxite/Qma13kPK6pcv8Z4Xjjw1MULfXgHxXPafp5Fqm1D9b5UXuv', + url: 'https://google.com', + sid: '839772', + app: 'asdf', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1669794334167', + title: 'asdf - [SDK-TEST] notification TITLE: 166979433416' + }, + secret: '' + }, + { + cta: '', + title: '[SDK-TEST] notification TITLE: 1669793429997', + message: '[sdk-test] notification BODY 1669793429997', + icon: 'https://gateway.ipfs.io/ipfs/bafybeih4qfevv2ms3tzognoscd5r5kenjcjjzvkzb6w6jctzcjzqoaxite/Qma13kPK6pcv8Z4Xjjw1MULfXgHxXPafp5Fqm1D9b5UXuv', + url: 'https://google.com', + sid: '839723', + app: 'asdf', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1669793429997', + title: 'asdf - [SDK-TEST] notification TITLE: 166979342999' + }, + secret: '' + }, + { + cta: '', + title: '[sdk-test] payload title 1668866110431', + message: 'type:3 identity:2', + icon: 'https://gateway.ipfs.io/ipfs/bafybeibmpivnqppyhg2avfnkk4v4idnfo4jvfmkdxthtkxwooaglg5kxau/QmbokNY79DDthAQ5QNc64HisnEvH7Q1Wdnay7Gg2yHqULo', + url: 'https://cryptobulb.io/', + sid: '802376', + app: 'CryptobulbNFT', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: '[sdk-test] notification BODY 1668866110431', + title: 'CryptobulbNFT - [SDK-TEST] notification TITLE: 166' + }, + secret: '' + } +] +``` + +</details> + +--- + +### **Fetching user subscriptions** + +```typescript +const subscriptions = await PushAPI.user.getSubscriptions({ + user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP + env: 'staging', +}); +``` + +where `subscriptions` is a list of channels `[{ channel: '0xaddress', ... }]` subscribed by the user. + +_Note: We can find out if a user is subscribed to a channel by checking if the channel address is present in the subscriptions list_ + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| user_ | string | - | user address (CAIP) | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (Fetching user opted in channels / subscriptions)</b></summary> + +```typescript +// PushAPI.user.getSubscriptions | Response - 200 OK +[ + { channel: '0x0000000000000000000000000000000000000000',user_settings: null }, + { channel: '0xa3B6712fB922cdbbdce9AB22571e75d0d81B3b00',user_settings: '[{"type": 1, "user": false, "index": 1, "default": false, "description": "test1"}, {"type": 2, "user": 25, "index": 2, "default": 25, "enabled": 1, "lowerLimit": 23, "upperLimit": 35, "description": "test3"}, {"type": 2, "user": 64, "index": 3, "default": 56, "enabled": 1, "lowerLimit": 43, "upperLimit": 78, "description": "test5"}]' }, + { channel: '0xde3aEA26fDC3ADdC1dB32baf1a058Cf0878FEac1',user_settings: null }, + { channel: '0x69e666767Ba3a661369e1e2F572EdE7ADC926029',user_settings: null }, + { channel: '0x466AEEf0943C5F098dBcEf3c1eEC03322E1F97eD',user_settings: null }, + { channel: '0xcE98113b998380729B04596e3eA0255fbA138D34',user_settings: null }, + { channel: '0xa89523351BE1e2De64937AA9AF61Ae06eAd199C7',user_settings: null }, + { channel: '0x0a651cF7A9b60082fecdb5f30DB7914Fd7d2cf93',user_settings: null }, + { channel: '0x0b5E9fa12C4C1946fA2f14b7271cC60541508f23',user_settings: null }, + { channel: '0x2AEcb6DeE3652dA1dD6b54D5fd4f7D8F43DaEb78',user_settings: null }, + { channel: '0xcB6C7b2E340D50701d45d55507f19A5cE5d72330',user_settings: null }, + { channel: '0xB59Cdc85Cacd15097ecE4C77ed9D225014b4D56D',user_settings: null }, + { channel: '0xA5E269eec042Bf61183DEf9911D03359597494b7',user_settings: null }, + { channel: '0x6bf1ee9DE5D11Fa558c1FA8D8855E26C38Fa582A',user_settings: null }, + { channel: '0x72Ac64A3aE0ab60D725980b73Ef460ED9e742cc7',user_settings: null }, + { channel: '0xEc6CbD318CB7BA8a0fBbffF697681C0a4ADA0349',user_settings: null }, + { channel: '0xAb9415961F58eBD6d79029bC76F261Fa65a80D3D',user_settings: null }, + { channel: '0x08D77bD7500a07d791dD1323919C22e1FDb72224',user_settings: null }, + { channel: '0xa1016081D6Da53b4246178eD83922C55F7171e54',user_settings: null }, + { channel: '0x6A06014AC6BdE2906D194e63ec3b1B5B4c9C2Abb',user_settings: null }, + { channel: '0xf69389475E082f4BeFDb9dee4a1E9fe6cd29f6e7',user_settings: null }, + { channel: '0x9601f08b9EcB981D273B72e7f33964Cb98f977fe',user_settings: null }, + { channel: '0x47A2910432016CA9f62B20dCE09b89d357d0c3d7',user_settings: null }, + { channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924',user_settings: null }, + { channel: '0x14c0157f9eEA7AEe61ba2606E75716E210b4697a',user_settings: null }, + { channel: '0x025846389950A13292E63e4794C7D148FF57F995',user_settings: null }, + { channel: '0x2aecb6dee3652da1dd6b54d5fd4f7d8f43daeb77',user_settings: null }, + { channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',user_settings: null }, + { channel: '0x19fB80f16EAFCfb5BBFa07451CC5694E8932EA52',user_settings: null }, + { channel: '0x94c3016ef3e503774630fC71F59B8Da9f7D470B7',user_settings: null }, +] +``` + +</details> + +--- + +### **Fetching channel details** + +```typescript +const channelData = await PushAPI.channels.getChannel({ + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP + env: 'staging', +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| channel_ | string | - | channel address (CAIP) | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (Fetching channel details)</b></summary> + +```typescript +// PushAPI.channels.getChannel | Response - 200 OK +{ + id: 39, + channel: '0xD8634C39BBFd4033c0d3289C4515275102423681', + ipfshash: 'bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + name: 'Gnosis', + info: 'Gnosis builds new market mechanisms for decentralized finance.\n', + url: 'https://gnosis.io', + icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + processed: 1, + attempts: 0, + alias_address: '0xD8634C39BBFd4033c0d3289C4515275102423681', + alias_verification_event: null, + is_alias_verified: 1, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-07T16:29:27.000Z', + blocked: 0, + counter: null, + subgraph_details: null +} +``` + +</details> + +--- + +### **Searching for channel(s)** + +```typescript +const channelsData = await PushAPI.channels.search({ + query: 'push', // a search query + page: 1, // page index + limit: 20, // no of items per page + env: 'staging', +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| query_ | string | - | search query | +| page | number | 1 | page index of the results | +| limit | number | 10 | number of items in 1 page | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (Searching for channel)</b></summary> + +```typescript +// PushAPI.channels.search | Response - 200 OK +[ + { + id: 58, + channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924', + ipfshash: 'QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74', + name: 'Ethereum Push Notification Service', + info: 'The channel provides useful information, notifications, etc to all the users of the EPNS platform. While not recommended, you can unsubcribe if you want to.', + url: 'https://epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihwgapkthxi6udojr7soqetk5xx22bdy56uupivcwkriaiqzwlyiu/QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 756, + }, + { + id: 817, + channel: '0xBA36124E8af635d9d32C4cC49802cacade133a5F', + ipfshash: 'QmUf7zuo4NXvkijhELfHAdmm8dQVY9VqesEs4xhobLZx4f', + name: 'push-ap-test', + info: 'testing push notifications', + url: 'https://www.google.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeigyk6kqiyn2dkburguqmnlkgvos4yld4hswcjcjnxbq6c5dqs7ih4/QmUf7zuo4NXvkijhELfHAdmm8dQVY9VqesEs4xhobLZx4f', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 57, + }, + { + id: 243, + channel: '0xC533ec1f876eA99088c85896F246C2ec8c7b05f9', + ipfshash: 'bafkreibc36t5tlygsa75w6nnkjmjieyzrohuscwzvohbj5tq6v6tgm2q4y', + name: 'EPNS PUSH Governance', + info: 'Get notifications on new proposals, grants, and stay up to date on all things PUSH Governance.', + url: 'https://epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihluvteyktaz6u7it6etf7jglqckcym5h5hxoqcilen73pcrz2wkq/bafkreibc36t5tlygsa75w6nnkjmjieyzrohuscwzvohbj5tq6v6tgm2q4y', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 9, + }, + { + id: 923, + channel: '0x7F69eec6cC1F619Ea8d27323d4430BbA5b739354', + ipfshash: 'QmeBqut7zMg4NSLbyEbUeLn2g9UnUE9fKjiVhYvWwJ3vqu', + name: 'Polygon Ahmedabad <> PUSH', + info: "You'll get cool notifications and update here.", + url: 'https://polygon.technology/blog/polygons-web3-made-in-india-tour-starts-rolling-with-7-guild-events-web3-education-programs', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiaxryfpf2gzmpq7uvye2kv3slru4vvdela5onldzder3zbbt3hoom/QmeBqut7zMg4NSLbyEbUeLn2g9UnUE9fKjiVhYvWwJ3vqu', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 9, + }, + { + id: 274, + channel: '0x554d29160f779Adf0a4328597cD33Ea1Df4D9Ee9', + ipfshash: 'bafkreichmnqqcn6tfcv5lnbbluchr3tqgbhiu45qnq56p2razdhvgnblcy', + name: 'Push Governance', + info: 'Get notifications on new proposals, grants, and stay up to date on all updates regarding PUSH Governance', + url: 'https://epns.io/gov', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihkfdd4lch5vvcmziowi7dmuum2pouvk3st4v5rvfxo3etcoxh7oe/bafkreichmnqqcn6tfcv5lnbbluchr3tqgbhiu45qnq56p2razdhvgnblcy', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 5, + }, + { + id: 1242, + channel: '0x453552953C4e2732A38B93F7fB834e5AeF6F60f8', + ipfshash: 'QmU7PC7yjdPfXJTgYuuqqvvWbxTn1rE3z8iWZEcorK3VPM', + name: 'Test push notifications', + info: 'Test push notifications', + url: 'https://www.youtube.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiarff4fukkj7fvmjuav6xvqzg5pfzyj2jcytzcbb5tdgyfzjfakfa/QmU7PC7yjdPfXJTgYuuqqvvWbxTn1rE3z8iWZEcorK3VPM', + processed: 1, + attempts: 0, + alias_address: '0x453552953C4e2732A38B93F7fB834e5AeF6F60f8', + alias_verification_event: + '{"aliasAddress": "0x453552953C4e2732A38B93F7fB834e5AeF6F60f8", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 5, + }, + { + id: 210, + channel: '0x8DaFfe9d1b5aDB33F53aDDC183C6b91F9cb30bc7', + ipfshash: 'bafkreiac6g3iul2uk6r6h2x5rsthgoq2y6uw23n4gzkvstfn7rl5tjq3v4', + name: 'PUSH for EthDenver', + info: 'Get notifications about everything EPNS at ETHDenver.', + url: 'http://ethdenver.epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeia2emdjy63kap2yqig3h4qlsjuawdby777osyr4rls2nyno2qsv6u/bafkreiac6g3iul2uk6r6h2x5rsthgoq2y6uw23n4gzkvstfn7rl5tjq3v4', + processed: 1, + attempts: 1, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 809, + channel: '0x9dFe790B3baBCBD888dA7093017a0B7A68b99937', + ipfshash: 'QmbrQeT4FdvYRQDrDhVvZ9XMhs2TUNSA7UHc4M53vvNcKK', + name: 'Push-Graph Test', + info: 'This channel is to test subgraph notifications.', + url: 'https://push.org/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihniwj5eflkxah7feqdgjnfuoyeq5iw4ka7qze3h6hdxsydx3gx3e/QmbrQeT4FdvYRQDrDhVvZ9XMhs2TUNSA7UHc4M53vvNcKK', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-03T12:26:00.000Z', + blocked: 0, + counter: 18, + subgraph_details: '60+aiswaryawalter/push-graph-test', + subscriber_count: 4, + }, + { + id: 956, + channel: '0x85Cb63e3D8cEf31a421e59b6678bF0444Fa5d8BE', + ipfshash: 'QmUAgUYKteWdpcWkKmNtySGY5w7XkRpUYdYtqcSfEfXzLP', + name: 'Transfer PUSHNOTIFICATION', + info: 'Notification for Transfer', + url: 'https://push.org/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidwsc4kws4fvzzsdj5e46re46qmwxmgidouhcfeel34xmhxbqbroe/QmUAgUYKteWdpcWkKmNtySGY5w7XkRpUYdYtqcSfEfXzLP', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 967, + channel: '0xa45bdc5B11ce6F0952401bE35156398d8c40Ce64', + ipfshash: 'QmPWEKaJsfVweeyWT5bCftXDnbDFMgqw3sVpTnKtd3fH5a', + name: 'Push Graph Notif', + info: 'Subgraph notification test', + url: 'https://push.org/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihlt5qyhs3g3ii5vrrhb4evcsltoa6bssb2qiuh3bamxx4ndorkr4/QmPWEKaJsfVweeyWT5bCftXDnbDFMgqw3sVpTnKtd3fH5a', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-03T12:26:00.000Z', + blocked: 0, + counter: 18, + subgraph_details: '60+aiswaryawalter/push-graph-test', + subscriber_count: 4, + }, + { + id: 1425, + channel: '0x49403ae592C82fc3f861cD0b9738f7524Fb1F38C', + ipfshash: 'QmZ1t5upH5zHxvzefWppVNfv7ciacrDq9VUL3SZJ7trnNz', + name: 'SuperPush', + info: 'Create, Update and Delete Superfluid streams seemlessly and get alerted to your device with Push Notifications for every actions.', + url: 'https://www.superfluid.finance/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeibfnawzeadz7d2exw2ncbytanzwjb3mdkx74whga5b5scz6mmuymu/QmZ1t5upH5zHxvzefWppVNfv7ciacrDq9VUL3SZJ7trnNz', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 0, + verified_status: 0, + timestamp: '2023-02-18T21:02:50.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 1659, + channel: '0x43097889162A9f2b7D85104f16aB7aB090056975', + ipfshash: 'QmQKuiR9nZw46pnrW16J7GZTsg3hteh93mWHcHV5Khrj24', + name: 'Push Protocol Demo', + info: 'A demo channel for testing out Push Protocol', + url: 'https://youtube.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiaadvr565fk5mkam4hlmnaxdb7lxemfcffzqd24berqxw6sf3efny/QmQKuiR9nZw46pnrW16J7GZTsg3hteh93mWHcHV5Khrj24', + processed: 1, + attempts: 1, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-20T04:40:04.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 287, + channel: '0x72F569DE6d77B1D4C3810767865FC706A1C39915', + ipfshash: 'bafkreidlxu5pnjeamnriukkqskv4v6ndfz5nifb2adrqwsvqiypg4oq4yi', + name: 'Push for DevConnect', + info: 'Stay upto date on all the happenings at DevConnect', + url: 'https://devconnect.org/schedule', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicgoxqjc3trzthp4chvdwyfe2nqm5lfaumkyztvm6vh6anwzztuty/bafkreidlxu5pnjeamnriukkqskv4v6ndfz5nifb2adrqwsvqiypg4oq4yi', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 369, + channel: '0x2b107f1B57F2A381dc8c09F8786FA3bdb3c70b27', + ipfshash: 'bafkreicnfx2wfjlphaoe7d3vttegbomdoc55n43p2r7wzpg2zzu2zcelrq', + name: 'Dapp Push notifications', + info: 'A channel to test out dapp push notifications', + url: 'animepahe.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihwyx4s5pv7afk7hskcvtz4j5o7yqkdwtb3t6mqsueqer4lbk53wy/bafkreicnfx2wfjlphaoe7d3vttegbomdoc55n43p2r7wzpg2zzu2zcelrq', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 445, + channel: '0x24a8E20a63DC3149BD7Ee136632161cDb8857522', + ipfshash: 'bafkreigglf54mwxxxzfhbexbyqgolyry4wfxkxvmxo3xojt6765rgi2r34', + name: 'Push Token Alerter', + info: 'Push Token alerter', + url: 'https://epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiaxnibay6ezfwmsytoiilcppa7piutbdzqzmm6vfcqi7wrmlx4qmm/bafkreigglf54mwxxxzfhbexbyqgolyry4wfxkxvmxo3xojt6765rgi2r34', + processed: 1, + attempts: 2, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 735, + channel: '0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F', + ipfshash: 'QmeMSv9UrL5znYJoLkJgKnivzaN67WnfCWB7donSx8AbXP', + name: 'Push x Polygon', + info: 'Push x Polygon Integration', + url: 'https://push.org', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiejlm3hfthuprnxyqj4onxnm3gy2tuygubaaapgw2bdhuqhhqggq4/QmeMSv9UrL5znYJoLkJgKnivzaN67WnfCWB7donSx8AbXP', + processed: 1, + attempts: 0, + alias_address: '0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F', + alias_verification_event: + '{"aliasAddress": "0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 737, + channel: '0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742', + ipfshash: 'QmZ3VQ87hNLeda2bgmvwZhKDaMgEboDVgGqTYktJGVNggG', + name: 'SeaLightPush', + info: 'Decentralized Exchange', + url: 'Https://SealightSwap.org', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicn4gmyg5gq3u3eoo5lbkuo4pbstrhw6uu2u6lgx6yd43e6zgxyg4/QmZ3VQ87hNLeda2bgmvwZhKDaMgEboDVgGqTYktJGVNggG', + processed: 1, + attempts: 0, + alias_address: '0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742', + alias_verification_event: + '{"aliasAddress": "0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 929, + channel: '0x983d0aD6D9c8778889311bC0E45DE417E9D74a90', + ipfshash: 'QmcqBzru5FFJDvLk7SYGEFYhgz9bokU77DWL4Kzt3NEDEJ', + name: 'Push amplify', + info: 'This channel will be used to test Push amplify features, and UI changes.', + url: 'https://twitter.com/pranshu3196', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihkrzovmnbscultfjfrnjqnsfqmrhrjuvnnokjwm35n7gcqy7xefi/QmcqBzru5FFJDvLk7SYGEFYhgz9bokU77DWL4Kzt3NEDEJ', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 1039, + channel: '0xc092d5Aa8c23165484486F246C828e4980b6C707', + ipfshash: 'QmXc2CE1c9fR34HVmkwQNaHRUvt7YxtiUcJfpBSbKTyBzD', + name: 'testPushHack', + info: 'test', + url: 'https://iamzub.in', + icon: 'https://gateway.ipfs.io/ipfs/bafybeia6djth6wbxpkujkxuftbkeot6d6atnhtyfb5k3bn5metcyj2pk3q/QmXc2CE1c9fR34HVmkwQNaHRUvt7YxtiUcJfpBSbKTyBzD', + processed: 1, + attempts: 1, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 1241, + channel: '0x11EaB508c309595F14E363e6a8d434BEab91eEBC', + ipfshash: 'QmZm14LgHZB2hYHcENkJNhrrL11QRKDCpX3AeVmXEiy2Hq', + name: 'Test for push', + info: 'Test for push', + url: 'https://www.youtube.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicnv3jv7ylfxqgb5cqyzzi4lumbjeqyimcljewqbexszjrqeqkn5m/QmZm14LgHZB2hYHcENkJNhrrL11QRKDCpX3AeVmXEiy2Hq', + processed: 1, + attempts: 0, + alias_address: '0x11EaB508c309595F14E363e6a8d434BEab91eEBC', + alias_verification_event: + '{"aliasAddress": "0x11EaB508c309595F14E363e6a8d434BEab91eEBC", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, +]; +``` + +</details> + +--- + +### **Opt in to a channel** + +```typescript +await PushAPI.channels.subscribe({ + signer: _signer, + channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP + userAddress: 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', // user address in CAIP + onSuccess: () => { + console.log('opt in success'); + }, + onError: () => { + console.error('opt in error'); + }, + env: 'staging', +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| signer_ | - | - | Signer object | +| channelAddress* | string | - | channel address (CAIP) | +| userAddress* | string | - | user address (CAIP) | | +| verifyingContractAddress | string | - | Push communicator contract address| +| onSuccess | function | - | on success callback | +| onError | function | - | on error callback | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (Opt in to channel)</b></summary> + +```typescript +// PushAPI.channels.subscribe | Response - 204 +{ status: 204, message: 'successfully opted into channel' } + +``` + +</details> + +--- + +### **Opt out to a channel** + +```typescript +await PushAPI.channels.unsubscribe({ + signer: _signer, + channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP + userAddress: 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', // user address in CAIP + onSuccess: () => { + console.log('opt out success'); + }, + onError: () => { + console.error('opt out error'); + }, + env: 'staging', +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| signer_ | - | - | Signer object | +| channelAddress* | string | - | channel address (CAIP) | +| userAddress* | string | - | user address (CAIP) | | +| verifyingContractAddress | string | - | Push communicator contract address| +| onSuccess | function | - | on success callback | +| onError | function | - | on error callback | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (Opt out of a channel)</b></summary> + +```typescript +// PushAPI.channels.unsubscribe | Response - 204 +{ status: 204, message: 'successfully opted out channel' } +``` + +</details> + +--- + +### **Sending notification** + +```typescript +async function sendNotification(options: { + senderType?: 0 | 1; + signer: any; + type: NOTIFICATION_TYPE; + identityType: IDENTITY_TYPE; + notification?: { + title: string; + body: string; + }; + payload?: { + sectype?: string; + title: string; + body: string; + cta: string; + img: string; + metadata?: any; + additionalMeta?: any; + }; + recipients?: string | string[]; // CAIP or plain ETH + channel: string; // CAIP or plain ETH + expiry?: number; + hidden?: boolean; + graph?: { + id: string; + counter: number; + }; + ipfsHash?: string; + env?: ENV; + chatId?: string; + pgpPrivateKey?: string; +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| senderType_ | number | 0 | 0 for channel notification. 1 for chat notification | +| signer* | - | - | Signer object | +| channel* | string | - | channel address (CAIP) | +| type* | number | - | Notification Type <br/>Target = 3 (send to 1 address), <br/>Subset = 4 (send to 1 or more addresses),<br/> Broadcast = 1 (send to all addresses) | +| identityType* | number | - | Identity Type <br/> Minimal = 0, <br/>IPFS = 1, <br/>Direct Payload = 2, <br/>Subgraph = 3 } | +| recipients* | string or string[] | - | for Notification Type = Target it is 1 address, <br /> for Notification Type = Subset, Broadcast it is an array of addresses (CAIP) | +| notification.title* | string | - | Push Notification Title (not required for identityType IPFS, Subgraph)| +| notification.body\* | string | - | Push Notification Body (not required for identityType IPFS, Subgraph)| +| payload.title | string | - | Notification Title (not required for identityType IPFS, Subgraph)| +| payload.body | string | - | Notification Body (not required for identityType IPFS, Subgraph)| +| payload.cta | string | - | Notification Call To Action url (not required for identityType IPFS, Subgraph)| +| payload.img | string | - | Notification Media url (not required for identityType IPFS, Subgraph)| +| payload.sectype | string | - | If Secret Notification then pass (not required for identityType IPFS, Subgraph)| +| graph.id | string | - | graph id, required only if the identityType is 3 | +| graph.counter | string | - | graph counter, required only if the identityType is 3 | +| ipfsHash | string | - | ipfsHash, required only if the identityType is 1 | +| expiry | number | - | (optional) epoch value if the notification has an expiry | +| hidden | boolean | false | (optional) true if we want to hide the notification | +| pgpPrivateKey | string | - | (optional) pgp private key for new notification verification proof | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +#### **Direct payload for single recipient(target)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target + identityType: PushAPI.payloads.IDENTITY_TYPE.DIRECT_PAYLOAD, // direct payload + notification: { + title: `[SDK-TEST] notification TITLE:`, + body: `[sdk-test] notification BODY`, + }, + payload: { + title: `[sdk-test] payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // recipient address + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Direct payload for group of recipients(subset)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: 4, // subset + identityType: 2, // direct payload + notification: { + title: `[SDK-TEST] notification TITLE:`, + body: `[sdk-test] notification BODY`, + }, + payload: { + title: `[sdk-test] payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: [ + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', + ], // recipients addresses + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Direct payload for all recipients(broadcast)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast + identityType: PushAPI.payloads.IDENTITY_TYPE.DIRECT_PAYLOAD, // direct payload + notification: { + title: `[SDK-TEST] notification TITLE:`, + body: `[sdk-test] notification BODY`, + }, + payload: { + title: `[sdk-test] payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **IPFS payload for single recipient(target)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target + identityType: PushAPI.payloads.IDENTITY_TYPE.IPFS, // ipfs payload + ipfsHash: 'bafkreicuttr5gpbyzyn6cyapxctlr7dk2g6fnydqxy6lps424mcjcn73we', // IPFS hash of the payload + recipients: 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', // recipient address + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **IPFS payload for group of recipients(subset)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.SUBSET, // subset + identityType: PushAPI.payloads.IDENTITY_TYPE.IPFS, // ipfs payload + ipfsHash: 'bafkreicuttr5gpbyzyn6cyapxctlr7dk2g6fnydqxy6lps424mcjcn73we', // IPFS hash of the payload + recipients: [ + 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', + 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', + ], // recipients addresses + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **IPFS payload for all recipients(broadcast)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast + identityType: PushAPI.payloads.IDENTITY_TYPE.DIRECT_PAYLOAD, // direct payload + ipfsHash: 'bafkreicuttr5gpbyzyn6cyapxctlr7dk2g6fnydqxy6lps424mcjcn73we', // IPFS hash of the payload + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Minimal payload for single recipient(target)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target + identityType: PushAPI.payloads.IDENTITY_TYPE.MINIMAL, // Minimal payload + notification: { + title: `[SDK-TEST] notification TITLE:`, + body: `[sdk-test] notification BODY`, + }, + payload: { + title: `[sdk-test] payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', // recipient address + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Minimal payload for a group of recipient(subset)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.SUBSET, // subset + identityType: PushAPI.payloads.IDENTITY_TYPE.MINIMAL, // Minimal payload + notification: { + title: `[SDK-TEST] notification TITLE:`, + body: `[sdk-test] notification BODY`, + }, + payload: { + title: `[sdk-test] payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: [ + 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', + 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', + ], // recipients address + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Minimal payload for all recipients(broadcast)** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast + identityType: PushAPI.payloads.IDENTITY_TYPE.MINIMAL, // Minimal payload + notification: { + title: `[SDK-TEST] notification TITLE:`, + body: `[sdk-test] notification BODY`, + }, + payload: { + title: `[sdk-test] payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Graph payload for single recipient(target)** + +**_Make sure the channel has the graph id you are providing!!_** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target + identityType: PushAPI.payloads.IDENTITY_TYPE.SUBGRAPH, // Subgraph payload + graph: { + id: '_your_graph_id', + counter: 3, + }, + recipients: 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', // recipient address + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Graph payload for group of recipients(subset)** + +**_Make sure the channel has the graph id you are providing!!_** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.SUBSET, // subset + identityType: PushAPI.payloads.IDENTITY_TYPE.SUBGRAPH, // graph payload + graph: { + id: '_your_graph_id', + counter: 3, + }, + recipients: [ + 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', + 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', + ], // recipients addresses + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +#### **Graph payload for all recipients(broadcast)** + +**_Make sure the channel has the graph id you are providing!!_** + +```typescript +// apiResponse?.status === 204, if sent successfully! +const apiResponse = await PushAPI.payloads.sendNotification({ + signer: _signer, + type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast + identityType: PushAPI.payloads.IDENTITY_TYPE.SUBGRAPH, // graph payload + graph: { + id: '_your_graph_id', + counter: 3, + }, + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + env: 'staging', +}); +``` + +<details> + <summary><b>Expected response (Send Notification)</b></summary> + +```typescript +// PushAPI.payloads.sendNotification | Response - 204 OK +``` + +</details> + +--- + +### Notification Helper Utils + +#### **Parsing notifications** + +Utils method to parse raw Push Feeds API response into a pre-defined shape as below. + +```typescript +// fetch some raw feeds data +const apiResponse = await PushAPI.user.getFeeds({ + user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address + raw: true, + env: 'staging', +}); +// parse it to get a specific shape of object. +const parsedResults = PushAPI.utils.parseApiResponse(apiResponse); + +const [oneNotification] = parsedResults; + +// Now this object can be directly used by for e.g. "@pushprotocol/uiweb" NotificationItem component as props. + +const { + cta, + title, + message, + app, + icon, + image, + url, + blockchain, + secret, + notification, +} = oneNotification; +``` + +_We get the above `keys` after the parsing of the API repsonse._ + +--- + +### Advanced Notifications (WIP) + +### DEPRECATED + +#### **Get a channel's subscriber list of addresses** + +```typescript +const subscribers = await PushAPI.channels.getSubscribers({ + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP + page: 1, // Optional, defaults to 1 + limit : 10 // Optional, defaults to 10 + env: 'staging' +}); +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| channel_ | string | - | channel address (CAIP) | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (Get channel's subscribers list)</b></summary> + +```typescript +// PushAPI.channels.getSubscribers | Response - 200 OK +{ + "itemcount": 11, + "subscribers": [ + "0x1d4f52775344f9a32093af0ccd03a4fb6dac8e30", + "0x28d615edd8404f8ca1e0271a0b5a48171589921a", + "0x4352639b99689069f9b0b847eee349c3c1b0706c", + "0x50029e62540537045bcfd3d320483865344edb33", + "0x5ac9e6205eaca2bbba6ef716fd9aabd76326eeee", + "0x778d3206374f8ac265728e18e3fe2ae6b93e4ce4", + "0xa44f2994750cf774eab05751d90ade4dedabe7fe", + "0xbcfb7da1dcf40e8cfb331683bb7d6f4eba091b08", + "0xcf5dbf241fc65a5af56c95101ac4e9ec2c57d941", + "0xd8634c39bbfd4033c0d3289c4515275102423681" + ] +} +``` + +</details> + +--- \ No newline at end of file diff --git a/packages/restapi/README.md b/packages/restapi/README.md index d38862a06..ccca693d7 100644 --- a/packages/restapi/README.md +++ b/packages/restapi/README.md @@ -18,32 +18,50 @@ This package gives access to Push Protocol (Push Nodes) APIs. Visit [Developer D - [Push core contract address](#push-core-contract-address) - [Push communicator contract address](#push-communicator-contract-address) - [SDK Features](#sdk-features) - - [For Notification](#for-notification) - - [Fetching user notifications](#fetching-user-notifications) - - [Fetching user spam notifications](#fetching-user-spam-notifications) - - [Fetching user subscriptions](#fetching-user-subscriptions) - - [Fetching channel details](#fetching-channel-details) - - [Searching for channel(s)](#searching-for-channels) - - [Opt in to a channel](#opt-in-to-a-channel) - - [Opt out to a channel](#opt-out-to-a-channel) - - [Sending notification](#sending-notification) - - [Direct payload for single recipient(target)](#direct-payload-for-single-recipienttarget) - - [Direct payload for group of recipients(subset)](#direct-payload-for-group-of-recipientssubset) - - [Direct payload for all recipients(broadcast)](#direct-payload-for-all-recipientsbroadcast) - - [IPFS payload for single recipient(target)](#ipfs-payload-for-single-recipienttarget) - - [IPFS payload for group of recipients(subset)](#ipfs-payload-for-group-of-recipientssubset) - - [IPFS payload for all recipients(broadcast)](#ipfs-payload-for-all-recipientsbroadcast) - - [Minimal payload for single recipient(target)](#minimal-payload-for-single-recipienttarget) - - [Minimal payload for a group of recipient(subset)](#minimal-payload-for-a-group-of-recipientsubset) - - [Minimal payload for all recipients(broadcast)](#minimal-payload-for-all-recipientsbroadcast) - - [Graph payload for single recipient(target)](#graph-payload-for-single-recipienttarget) - - [Graph payload for group of recipients(subset)](#graph-payload-for-group-of-recipientssubset) - - [Graph payload for all recipients(broadcast)](#graph-payload-for-all-recipientsbroadcast) - - [Notification Helper Utils](#notification-helper-utils) - - [Parsing notifications](#parsing-notifications) - - [Advanced Notifications (WIP)](#advanced-notifications-wip) - - [DEPRECATED](#deprecated) - - [Get a channel's subscriber list of addresses](#get-a-channels-subscriber-list-of-addresses) + - [PushNotification Class](#pushnotification-class) + - [Initialize](#initialize) + - [Fetch Inbox Or Spam notifications](#fetch-inbox-or-spam-notifications) + - [Fetch user subscriptions](#fetch-user-subscriptions) + - [Subscribe to a channel](#subscribe-to-a-channel) + - [Unsubscribe to a channel](#unsubscribe-to-a-channel) + - [Channel information](#channel-information) + - [Search Channels](#search-channels) + - [Get Subscribers Of A Channel](#get-subscribers-of-a-channel) + - [Send a notification](#send-a-notification) + - [Create a channel](#create-a-channel) + - [Update channel information](#update-channel-information) + - [Verify a channel](#verify-a-channel) + - [Create channel Setting (WIP)](#create-channel-setting) + - [Get delegators information](#get-delegators-information) + - [Add delegator to a channel or alias](#add-delegator-to-a-channel-or-alias) + - [Remove delegator from a channel or alias](#remove-delegator-from-a-channel-or-alias) + - [Alias Information](#alias-information) + - [Stream Notifications](#stream-notifications) + - [PushChat Class](#pushchat-class) + - [Initialize](#initialize) + - [Fetch Info](#fetch-info) + - [Fetch Profile Info](#fetch-profile-info) + - [Update Profile Info](#update-profile-info) + - [Fetch Latest Chat](#fetch-latest-chat) + - [Fetch Chat History](#fetch-chat-history) + - [Send Message](#send-message) + - [Accept Chat Request](#accept-chat-request) + - [Reject Chat Request](#reject-chat-request) + - [Block Chat User](#block-chat-user) + - [Unblock Chat User](#unblock-chat-user) + - [Create Group](#create-group) + - [Fetch Group Info](#fetch-group-info) + - [Fetch Group Permission](#fetch-group-permissions) + - [Update Group](#update-group) + - [Add To Group](#add-to-group) + - [Remove From Group](#remove-from-group) + - [Join Group](#join-group) + - [Leave Group](#leave-group) + - [Reject Group Joining Request](#reject-group-joining-request) + - [Fetch Encryption Info](#fetch-encryption-info) + - [Update Encryption](#update-encryption) + - [Stream Chat Events](#stream-chat-events) + - [Stream Chat Ops Events](#stream-chat-ops-events) - [For Video](#for-video) - [Instance Variables](#instance-variables) - [peerInstance](#peerinstance) @@ -80,30 +98,6 @@ This package gives access to Push Protocol (Push Nodes) APIs. Visit [Developer D - [Fetching list of user spaces](#fetching-list-of-user-spaces) - [Fetching list of user space requests](#fetching-list-of-user-space-requests) - [Fetching list of trending spaces](#fetching-list-of-trending-spaces) - - [PushAPI Class](#pushapi-class) - - [Initialize](#initialize) - - [Fetch Info](#fetch-info) - - [Fetch Profile Info](#fetch-profile-info) - - [Update Profile Info](#update-profile) - - [Fetch Latest Chat](#fetch-latest-chat) - - [Fetch Chat History](#fetch-chat-history) - - [Send Message](#send-message) - - [Accept Chat Request](#accept-chat-request) - - [Reject Chat Request](#reject-chat-request) - - [Block Chat User](#block-chat-user) - - [Unblock Chat User](#unblock-chat-user) - - [Create Group](#create-group) - - [Fetch Group Info](#fetcg-group-info) - - [Fetch Group Permission](#fetch-group-permissions) - - [Update Group Info](#update-group-info) - - [Add To Group](#add-to-group) - - [Remove From Group](#remove-from-group) - - [Join Group](#join-group) - - [Leave Group](#leave-group) - - [Reject Group Joining Request](#reject-group-joining-request) - - [Fetch Encryption Info](#fetch-encryption-info) - - [Update Encryption](#update-encryption) - # How to use in your app? ## Installation @@ -181,4041 +175,3942 @@ Binance Mainnet - 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa Binance Testnet - 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa Optimism Mainnet - 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa Optimism Testnet - 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa +Arbitrum Mainnet - 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa +Arbitrum One Testnet - 0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa ``` # SDK Features -## For Notification -### **Fetching user notifications** +## For Video + +### **Instance Variables** + +#### **peerInstance** + +- Used to store the simple peer instance used for the webRTC connection. ```typescript -const notifications = await PushAPI.user.getFeeds({ - user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP - env: 'staging', -}); +private peerInstance: any = null; ``` -<details> - <summary><b>Expected response (Fetching user notifications)</b></summary> +--- + +#### **signer** + +- Used to store the signer of a user. +- Used in the request, acceptRequest and disconnect methods to send notifications. ```typescript -// PushAPI.user.getFeeds | Response - 200 OK -[ - { - cta: 'https://idle.finance/#/governance/proposals', - title: 'New Proposal', - message: - '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + - '\n' + - '[d:Proposal] : IIP-32: Add Euler staking PYT wrappers for AA tranche to IdleDAI\n' + - '[timestamp:1676570405.922][timestamp: 1676570405]', - icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', - url: 'https://idle.finance/', - sid: '3401597', - app: 'Idle Finance', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: 'New Proposal On Idle Finance', - title: 'Idle Finance - New Proposal', - }, - secret: '', - }, - { - cta: '', - title: '', - message: 'hi socket', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', - url: 'https://www.google.com/', - sid: '2491520', - app: 'AKP Test Channel', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { body: 'hi socket', title: 'AKP Test Channel - ' }, - secret: '', - }, - { - cta: '', - title: '', - message: 'hiii', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', - url: 'https://www.google.com/', - sid: '2490919', - app: 'AKP Test Channel', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { body: 'hiii', title: 'AKP Test Channel - ' }, - secret: '', - }, - { - cta: '', - title: '', - message: 'Hey -testing', - icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', - url: 'https://gnosis.io', - sid: '2429211', - app: 'Gnosis', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { body: 'Hey -testing', title: 'Gnosis - ' }, - secret: '', - }, - { - cta: '', - title: '', - message: 'Hey', - icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', - url: 'https://gnosis.io', - sid: '2429210', - app: 'Gnosis', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { body: 'Hey', title: 'Gnosis - ' }, - secret: '', - }, - { - cta: 'https://idle.finance/#/governance/proposals', - title: 'New Proposal', - message: - '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + - '\n' + - '[d:Proposal] : IIP-31: Add AA Euler staking PYT wrappers to IdleUSDT, IdleUSDC and IdleWETH. Gauges rate to 0. Extend LM. \n' + - '[timestamp:1674583206.258][timestamp: 1674583206]', - icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', - url: 'https://idle.finance/', - sid: '1784234', - app: 'Idle Finance', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: 'New Proposal On Idle Finance', - title: 'Idle Finance - New Proposal', - }, - secret: '', - }, - { - cta: '', - title: '', - message: 'hi 2023', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', - url: 'https://www.google.com/', - sid: '1132231', - app: 'AKP Test Channel', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { body: 'hi 2023', title: 'AKP Test Channel - ' }, - secret: '', - }, - { - cta: '', - title: '', - message: 'hi', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', - url: 'https://www.google.com/', - sid: '1132230', - app: 'AKP Test Channel', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { body: 'hi', title: 'AKP Test Channel - ' }, - secret: '', - }, - { - cta: 'https://idle.finance/#/governance/proposals', - title: 'New Proposal', - message: - '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + - '\n' + - '[d:Proposal] : IIP-30: Remove idleDAI wrapper for cpFOL-USDC (DAI) senior. Same for idleUSDC with cpWIN-USDC. Remove idleRAI, idleSUSD, idleTUSD and idleFEI from IdleController. Update voting delay in Governor \n' + - ' \n' + - '[timestamp:1672769747.911][timestamp: 1672769747]', - icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', - url: 'https://idle.finance/', - sid: '1080072', - app: 'Idle Finance', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: 'New Proposal On Idle Finance', - title: 'Idle Finance - New Proposal', - }, - secret: '', - }, - { - cta: 'https://idle.finance/#/governance/proposals', - title: 'New Proposal', - message: - '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + - '\n' + - '[d:Proposal] : IIP-29: Remove idleDAI wrapper for cpFOL-USDC (DAI) senior. Same for idleUSDC with cpWIN-USDC. Remove idleRAI, idleSUSD, idleTUSD and idleFEI from IdleController. Update voting delay in Governor \n' + - ' \n' + - '[timestamp:1671624005.155][timestamp: 1671624005]', - icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', - url: 'https://idle.finance/', - sid: '935285', - app: 'Idle Finance', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: 'New Proposal On Idle Finance', - title: 'Idle Finance - New Proposal', - }, - secret: '', - }, -]; + private signer: SignerType; ``` -</details> +--- + +#### **chainId** + +The chain id of the chain on which the call is being conducted. + +```typescript + private chainId: number; +``` --- -### **Fetching user spam notifications** +#### **pgpPrivateKey** + +- Used to store the PGP private key of a user. +- Used in the request, acceptRequest and disconnect methods to send notifications. ```typescript -const spams = await PushAPI.user.getFeeds({ - user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP - spam: true, - env: 'staging', -}); + private pgpPrivateKey: string; ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| user_ | string | - | user account address (CAIP) | -| page | number | 1 | page index of the results | -| limit | number | 10 | number of items in 1 page | -| spam | boolean | false | if "true" it will fetch spam feeds | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -| raw | boolean | false | if "true" the method will return unformatted raw API response| +--- -<details> - <summary><b>Expected response (Fetching user spam notifications)</b></summary> +#### **env** + +- The environment on which the call is being conducted. ```typescript -PushAPI.user.getFeeds [Spam] | Response - 200 OK -[ - { - cta: 'https://goerli.etherscan.io/tx/0xe1d230d2139b0d726d5a80713ac437bed3b55b808eb651d85d8b86a377b56aa3', - title: 'PUSH Tokens Received', - message: 'Received 500 PUSH from 0x69e666767ba3a661369e1e2f572ede7adc926029', - icon: 'https://gateway.ipfs.io/ipfs/bafybeih7t3hftdcfz6axqvcnszou6tfo6blrlmis3cns33jad7dqhdcjpi/Qmah3yyjjcQGtkHDRkyrs4VoXsrgyr9SqEsLekLPW2nhpb', - url: 'https://uniswap.org', - sid: '3436148', - app: 'Uniswap Test', - image: 'https://play-lh.googleusercontent.com/i911_wMmFilaAAOTLvlQJZMXoxBF34BMSzRmascHezvurtslYUgOHamxgEnMXTklsF-S', - blockchain: 'THE_GRAPH', - notification: { - body: 'Received 500 PUSH from 0x69e666767ba3a661369e1e2f572ede7adc926029', - title: 'Uniswap Test - PUSH Tokens Received' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title', - message: 'sample msg body', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihvggzdcvfbjw4bqytpbldeauc7chru3mj62wz4af7lezqvuyxj6i/QmW8vCUVk43gtm8CzAqKBUR13HK4fiaFHk7EfEnJYSonZw', - url: 'https://stream-2-earn.vercel.app/', - sid: '3258266', - app: 'Stream2Earn', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY', - title: 'Stream2Earn - [SDK-TEST] notification TITLE:' - }, - secret: '' - }, - { - cta: 'https://goerli.etherscan.io/tx/0xc4a01fd9ac033b5e00b45ad52af51821add8db4f31cae93e19326aff01b4e9c7', - title: 'PUSH Tokens Received', - message: 'Received 50 PUSH from 0x7b9e036bd304fd1bea0523de718038bbe345521a', - icon: 'https://gateway.ipfs.io/ipfs/bafybeih7t3hftdcfz6axqvcnszou6tfo6blrlmis3cns33jad7dqhdcjpi/Qmah3yyjjcQGtkHDRkyrs4VoXsrgyr9SqEsLekLPW2nhpb', - url: 'https://uniswap.org', - sid: '2868333', - app: 'Uniswap Test', - image: 'https://play-lh.googleusercontent.com/i911_wMmFilaAAOTLvlQJZMXoxBF34BMSzRmascHezvurtslYUgOHamxgEnMXTklsF-S', - blockchain: 'THE_GRAPH', - notification: { - body: 'Received 50 PUSH from 0x7b9e036bd304fd1bea0523de718038bbe345521a', - title: 'Uniswap Test - PUSH Tokens Received' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title 1675241933583', - message: 'type:3 identity:2', - icon: 'na', - url: 'https://app.push.org', - sid: '2427470', - app: 'internal', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1675241933583', - title: 'internal - [SDK-TEST] notification TITLE: 16752419' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title 1673154212899', - message: 'type:3 identity:2', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihffthqhvxdt73pe4voisz63mm2fydnrctypmh5byaglujjejjvzm/QmcHvKxoCDgN7mH2sMzFkoqDaRLUWdNMa2FbJbGRVkdF3d', - url: 'https://www.google.com', - sid: '1178703', - app: 'Test Channel', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1673154212899', - title: 'Test Channel - [SDK-TEST] notification TITLE: 1673' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title 1673154141751', - message: 'type:3 identity:2', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihffthqhvxdt73pe4voisz63mm2fydnrctypmh5byaglujjejjvzm/QmcHvKxoCDgN7mH2sMzFkoqDaRLUWdNMa2FbJbGRVkdF3d', - url: 'https://www.google.com', - sid: '1178702', - app: 'Test Channel', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1673154141751', - title: 'Test Channel - [SDK-TEST] notification TITLE: 1673' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title 1669794606748', - message: 'type:4 identity:2', - icon: 'https://gateway.ipfs.io/ipfs/bafybeih4qfevv2ms3tzognoscd5r5kenjcjjzvkzb6w6jctzcjzqoaxite/Qma13kPK6pcv8Z4Xjjw1MULfXgHxXPafp5Fqm1D9b5UXuv', - url: 'https://google.com', - sid: '839794', - app: 'asdf', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1669794606748', - title: 'asdf - [SDK-TEST] notification TITLE: 166979460674' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title 1669794334167', - message: 'type:4 identity:2', - icon: 'https://gateway.ipfs.io/ipfs/bafybeih4qfevv2ms3tzognoscd5r5kenjcjjzvkzb6w6jctzcjzqoaxite/Qma13kPK6pcv8Z4Xjjw1MULfXgHxXPafp5Fqm1D9b5UXuv', - url: 'https://google.com', - sid: '839772', - app: 'asdf', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1669794334167', - title: 'asdf - [SDK-TEST] notification TITLE: 166979433416' - }, - secret: '' - }, - { - cta: '', - title: '[SDK-TEST] notification TITLE: 1669793429997', - message: '[sdk-test] notification BODY 1669793429997', - icon: 'https://gateway.ipfs.io/ipfs/bafybeih4qfevv2ms3tzognoscd5r5kenjcjjzvkzb6w6jctzcjzqoaxite/Qma13kPK6pcv8Z4Xjjw1MULfXgHxXPafp5Fqm1D9b5UXuv', - url: 'https://google.com', - sid: '839723', - app: 'asdf', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1669793429997', - title: 'asdf - [SDK-TEST] notification TITLE: 166979342999' - }, - secret: '' - }, - { - cta: '', - title: '[sdk-test] payload title 1668866110431', - message: 'type:3 identity:2', - icon: 'https://gateway.ipfs.io/ipfs/bafybeibmpivnqppyhg2avfnkk4v4idnfo4jvfmkdxthtkxwooaglg5kxau/QmbokNY79DDthAQ5QNc64HisnEvH7Q1Wdnay7Gg2yHqULo', - url: 'https://cryptobulb.io/', - sid: '802376', - app: 'CryptobulbNFT', - image: '', - blockchain: 'ETH_TEST_GOERLI', - notification: { - body: '[sdk-test] notification BODY 1668866110431', - title: 'CryptobulbNFT - [SDK-TEST] notification TITLE: 166' - }, - secret: '' - } -] +private env: ENV; ``` -</details> +--- + +### **data** + +- Stores data related to the video call. + +```typescript +export type IMediaStream = MediaStream | null; + +export enum VideoCallStatus { + UNINITIALIZED, + INITIALIZED, + RECEIVED, + CONNECTED, + DISCONNECTED, + RETRY_INITIALIZED, + RETRY_RECEIVED, +} + +export type PeerData = { + stream: IMediaStream; // incoming media stream + audio: boolean | null; // incoming audio status + video: boolean | null; // incoming video status + address: string; // incoming address + status: VideoCallStatus; // status for the connection with incoming peer + retryCount: number; // number of retires done +}; + +export type VideoCallData = { + meta: { + chatId: string; // unique chatId for the corresponding push w2w chat + initiator: { + address: string; // initiator's address + signal: any; // initiator's signaling data for webRTC connection + }; + broadcast?: { + livepeerInfo: any; + hostAddress: string; + coHostAddress: string; + }; + }; + local: { + stream: IMediaStream; // local media stream + audio: boolean | null; // local audio status + video: boolean | null; // local video status + address: string; // local address + }; + incoming: [PeerData]; +}; + +private data: VideoCallData; +``` --- -### **Fetching user subscriptions** +#### **setData** + +- This function can be used to update the video call `data` ```typescript -const subscriptions = await PushAPI.user.getSubscriptions({ - user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address in CAIP - env: 'staging', +setData: (fn: (data: VideoCallData) => VideoCallData) => void; + +// usage + +import { produce } from 'immer'; + +setData((oldData) => { + return produce(oldData, (draft) => { + // update the draft object, example + draft.incoming.status = VideoCallStatus.INITIALIZED; + }); }); ``` -where `subscriptions` is a list of channels `[{ channel: '0xaddress', ... }]` subscribed by the user. +--- + +### **Methods** + +#### **constructor** -_Note: We can find out if a user is subscribed to a channel by checking if the channel address is present in the subscriptions list_ +```typescript +constructor({ + signer, + chainId, + pgpPrivateKey, + env, + setData, + }: { + signer: SignerType; + chainId: number; + pgpPrivateKey: string; + env?: ENV; + setData: (fn: (data: VideoCallData) => VideoCallData) => void; + }) {} +``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| user_ | string | - | user address (CAIP) | +| signer_ | SignerType | - | signer object for a user | +| chainId* | number | - | chainId for the video call - Eth Mainnet: 1, Polygon Mainnet: 137 | +| pgpPrivatekey* | string | - | PGP private key of the user, used while sending video call notifications | | env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| setData\* | `(fn: (data: VideoCallData) => VideoCallData) => void` | - | Function to update video call data | -<details> - <summary><b>Expected response (Fetching user opted in channels / subscriptions)</b></summary> +--- + +#### **create** + +- This method is used to create a local stream +- Assigns the local stream obtained from the `navigator.mediaDevices.getUserMedia` to `data.local.stream` state. ```typescript -// PushAPI.user.getSubscriptions | Response - 200 OK -[ - { channel: '0x0000000000000000000000000000000000000000' }, - { channel: '0xa3B6712fB922cdbbdce9AB22571e75d0d81B3b00' }, - { channel: '0xde3aEA26fDC3ADdC1dB32baf1a058Cf0878FEac1' }, - { channel: '0x69e666767Ba3a661369e1e2F572EdE7ADC926029' }, - { channel: '0x466AEEf0943C5F098dBcEf3c1eEC03322E1F97eD' }, - { channel: '0xcE98113b998380729B04596e3eA0255fbA138D34' }, - { channel: '0xa89523351BE1e2De64937AA9AF61Ae06eAd199C7' }, - { channel: '0x0a651cF7A9b60082fecdb5f30DB7914Fd7d2cf93' }, - { channel: '0x0b5E9fa12C4C1946fA2f14b7271cC60541508f23' }, - { channel: '0x2AEcb6DeE3652dA1dD6b54D5fd4f7D8F43DaEb78' }, - { channel: '0xcB6C7b2E340D50701d45d55507f19A5cE5d72330' }, - { channel: '0xB59Cdc85Cacd15097ecE4C77ed9D225014b4D56D' }, - { channel: '0xA5E269eec042Bf61183DEf9911D03359597494b7' }, - { channel: '0x6bf1ee9DE5D11Fa558c1FA8D8855E26C38Fa582A' }, - { channel: '0x72Ac64A3aE0ab60D725980b73Ef460ED9e742cc7' }, - { channel: '0xEc6CbD318CB7BA8a0fBbffF697681C0a4ADA0349' }, - { channel: '0xAb9415961F58eBD6d79029bC76F261Fa65a80D3D' }, - { channel: '0x08D77bD7500a07d791dD1323919C22e1FDb72224' }, - { channel: '0xa1016081D6Da53b4246178eD83922C55F7171e54' }, - { channel: '0x6A06014AC6BdE2906D194e63ec3b1B5B4c9C2Abb' }, - { channel: '0xf69389475E082f4BeFDb9dee4a1E9fe6cd29f6e7' }, - { channel: '0x9601f08b9EcB981D273B72e7f33964Cb98f977fe' }, - { channel: '0x47A2910432016CA9f62B20dCE09b89d357d0c3d7' }, - { channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' }, - { channel: '0x14c0157f9eEA7AEe61ba2606E75716E210b4697a' }, - { channel: '0x025846389950A13292E63e4794C7D148FF57F995' }, - { channel: '0x2aecb6dee3652da1dd6b54d5fd4f7d8f43daeb77' }, - { channel: '0xD8634C39BBFd4033c0d3289C4515275102423681' }, - { channel: '0x19fB80f16EAFCfb5BBFa07451CC5694E8932EA52' }, - { channel: '0x94c3016ef3e503774630fC71F59B8Da9f7D470B7' }, -]; +export type VideoCreateInputOptions = { + video?: boolean; + audio?: boolean; +}; + +async create(options: VideoCreateInputOptions): Promise<void> {} ``` -</details> +Allowed Options (params with \* are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| video | boolean | true | video status for the local stream | +| audio | boolean | true | audio status for the local stream | + +Note - If audio, video aren't enabled in create() then they wont be available during the call respectively. --- -### **Fetching channel details** +#### **request** + +- This method is used to request a push video call. +- Will be triggered on the initiator's end. ```typescript -const channelData = await PushAPI.channels.getChannel({ - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP - env: 'staging', -}); +export type VideoRequestInputOptions = { + senderAddress: string; + recipientAddress: string; + chatId: string; + onReceiveMessage?: (message: string) => void; + retry?: boolean; +}; + +async request(options: VideoRequestInputOptions): Promise<void> {} ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| channel_ | string | - | channel address (CAIP) | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| - -<details> - <summary><b>Expected response (Fetching channel details)</b></summary> - -```typescript -// PushAPI.channels.getChannel | Response - 200 OK -{ - id: 39, - channel: '0xD8634C39BBFd4033c0d3289C4515275102423681', - ipfshash: 'bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', - name: 'Gnosis', - info: 'Gnosis builds new market mechanisms for decentralized finance.\n', - url: 'https://gnosis.io', - icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', - processed: 1, - attempts: 0, - alias_address: '0xD8634C39BBFd4033c0d3289C4515275102423681', - alias_verification_event: null, - is_alias_verified: 1, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-02-07T16:29:27.000Z', - blocked: 0, - counter: null, - subgraph_details: null -} -``` - -</details> +| senderAddress_ | string | - | Local peer address | +| recipientAddress* | string | - | Incoming/remote peer address | +| chatId* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | +| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | +| retry | boolean | false | If we are retrying the call, only for internal use | --- -### **Searching for channel(s)** +#### **acceptRequest** + +- This method is used to accept a push video call. +- Will be triggered on the receiver's end. ```typescript -const channelsData = await PushAPI.channels.search({ - query: 'push', // a search query - page: 1, // page index - limit: 20, // no of items per page - env: 'staging', -}); +export type VideoAcceptRequestInputOptions = { + signalData: any; + senderAddress: string; + recipientAddress: string; + chatId: string; + onReceiveMessage?: (message: string) => void; + retry?: boolean; +}; + +async acceptRequest(options: VideoAcceptRequestInputOptions): Promise<void> {} ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| query_ | string | - | search query | -| page | number | 1 | page index of the results | -| limit | number | 10 | number of items in 1 page | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| signalData_ | any | - | Signal data received from the initiator peer via psuh notification upon call request | +| senderAddress* | string | - | Local peer address | +| recipientAddress* | string | - | Incoming/remote peer address | +| chatId\* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | +| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | +| retry | boolean | false | If we are retrying the call, only for internal use | -<details> - <summary><b>Expected response (Searching for channel)</b></summary> +--- -```typescript -// PushAPI.channels.search | Response - 200 OK -[ - { - id: 58, - channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924', - ipfshash: 'QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74', - name: 'Ethereum Push Notification Service', - info: 'The channel provides useful information, notifications, etc to all the users of the EPNS platform. While not recommended, you can unsubcribe if you want to.', - url: 'https://epns.io/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihwgapkthxi6udojr7soqetk5xx22bdy56uupivcwkriaiqzwlyiu/QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 756, - }, - { - id: 817, - channel: '0xBA36124E8af635d9d32C4cC49802cacade133a5F', - ipfshash: 'QmUf7zuo4NXvkijhELfHAdmm8dQVY9VqesEs4xhobLZx4f', - name: 'push-ap-test', - info: 'testing push notifications', - url: 'https://www.google.com', - icon: 'https://gateway.ipfs.io/ipfs/bafybeigyk6kqiyn2dkburguqmnlkgvos4yld4hswcjcjnxbq6c5dqs7ih4/QmUf7zuo4NXvkijhELfHAdmm8dQVY9VqesEs4xhobLZx4f', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 57, - }, - { - id: 243, - channel: '0xC533ec1f876eA99088c85896F246C2ec8c7b05f9', - ipfshash: 'bafkreibc36t5tlygsa75w6nnkjmjieyzrohuscwzvohbj5tq6v6tgm2q4y', - name: 'EPNS PUSH Governance', - info: 'Get notifications on new proposals, grants, and stay up to date on all things PUSH Governance.', - url: 'https://epns.io/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihluvteyktaz6u7it6etf7jglqckcym5h5hxoqcilen73pcrz2wkq/bafkreibc36t5tlygsa75w6nnkjmjieyzrohuscwzvohbj5tq6v6tgm2q4y', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 9, +#### **connect** + +- This is the final method which is used to connect a push video call. +- Will be triggered on the initiator's end. + +```typescript +export type VideoConnectInputOptions = { + signalData: any; + peerAddress?: string; +}; + +connect(options: VideoConnectInputOptions): void {} +``` + +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| signalData_ | any | - | Signal data received from the receiver peer via push notification upon call acceptRequest | +| peerAddress | string | data.incoming[0].address | Address of the receiver peer, received via push notification upon call acceptRequest | + +--- + +#### **disconnect** + +- This method is used to end a push video call. +- Can be triggered on the initiator as well as receivers end. + +```typescript +export type VideoDisconnectOptions = { + peerAddress: string; +} | null; + +disconnect(options: VideoDisconnectOptions): void {} +``` + +Allowed Options (params with \* are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| peerAddress | string | data.incoming[0].address | Address of the peer to be disconnected from | + +--- + +#### **enableVideo** + +- This method is used to enable/disable the video (from `data.local.stream`) for a push video call. +- Can be triggered on the initiator as well as receivers end. +- **Note -** If video was not enabled during `create()` then it will always remain off. + +```typescript + export type EnableVideoInputOptions = { + state: boolean; +} + +enableVideo(options: EnableVideoInputOptions): void +``` + +Allowed Options (params with \* are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| state | boolean | - | true for enable and false for disable | + +--- + +#### **enableAudio** + +- This method is used to enable/disable the audio (from `data.local.stream`) for a push video call. +- Can be triggered on the initiator as well as receivers end. +- **Note -** If audio was not enabled during `create()` then it will always remain off. + +```typescript +export type EnableAudioInputOptions = { + state: boolean; +} + +enableAudio(options: EnableAudioInputOptions): void +``` + +Allowed Options (params with \* are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| state | boolean | - | true for enable and false for disable | + +--- + +#### **isInitiator** + +- This method is used to tell if the current peer is the initator of the push video call or not. +- Can be triggered on the initiator as well as receivers end. + +```typescript +isInitiator(): boolean +``` + +--- + +## For Spaces + +### **To create a space** + +```typescript +// pre-requisite API calls that should be made before +// need to get user and through that encryptedPvtKey of the user +const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); + +// need to decrypt the encryptedPvtKey to pass in the api using helper function +const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); + +// actual api +const response = await PushAPI.space.create({ + spaceName:'wasteful_indigo_warbler', + spaceDescription: 'boring_emerald_gamefowl', + listeners: ['0x9e60c47edF21fa5e5Af33347680B3971F2FfD464','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + spaceImage: <space image link> , + speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + isPublic: true, + account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', + env: 'staging', + pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key + scheduleAt: new Date("2024-07-15T14:48:00.000Z"), + scheduleEnd: new Date("2024-07-15T15:48:00.000Z") +}); +``` + +### **To create a token gated space** + +```typescript +// pre-requisite API calls that should be made before +// need to get user and through that encryptedPvtKey of the user +const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); + +// need to decrypt the encryptedPvtKey to pass in the api using helper function +const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); + +// actual api +const response = await PushAPI.space.create({ + spaceName:'wasteful_indigo_warbler', + spaceDescription: 'boring_emerald_gamefowl', + listeners: ['0x9e60c47edF21fa5e5Af33347680B3971F2FfD464','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + spaceImage: <space image link> , + speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + rules: { + 'spaceAccess': { + 'conditions': [ + { + 'any': [ + { + 'type': 'PUSH', + 'category': 'ERC20', + 'subcategory': 'holder', + 'data': { + 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1000, + 'decimals': 18 + } + }, + { + 'type': 'GUILD', + 'category': 'guildRoles', + 'subcategory': 'specificRole', + 'data': { + 'guildId': '13468', + 'guildRoleId': '19924' + } + } + ] + } + ] + } }, - { - id: 923, - channel: '0x7F69eec6cC1F619Ea8d27323d4430BbA5b739354', - ipfshash: 'QmeBqut7zMg4NSLbyEbUeLn2g9UnUE9fKjiVhYvWwJ3vqu', - name: 'Polygon Ahmedabad <> PUSH', - info: "You'll get cool notifications and update here.", - url: 'https://polygon.technology/blog/polygons-web3-made-in-india-tour-starts-rolling-with-7-guild-events-web3-education-programs', - icon: 'https://gateway.ipfs.io/ipfs/bafybeiaxryfpf2gzmpq7uvye2kv3slru4vvdela5onldzder3zbbt3hoom/QmeBqut7zMg4NSLbyEbUeLn2g9UnUE9fKjiVhYvWwJ3vqu', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 9, - }, - { - id: 274, - channel: '0x554d29160f779Adf0a4328597cD33Ea1Df4D9Ee9', - ipfshash: 'bafkreichmnqqcn6tfcv5lnbbluchr3tqgbhiu45qnq56p2razdhvgnblcy', - name: 'Push Governance', - info: 'Get notifications on new proposals, grants, and stay up to date on all updates regarding PUSH Governance', - url: 'https://epns.io/gov', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihkfdd4lch5vvcmziowi7dmuum2pouvk3st4v5rvfxo3etcoxh7oe/bafkreichmnqqcn6tfcv5lnbbluchr3tqgbhiu45qnq56p2razdhvgnblcy', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 5, - }, - { - id: 1242, - channel: '0x453552953C4e2732A38B93F7fB834e5AeF6F60f8', - ipfshash: 'QmU7PC7yjdPfXJTgYuuqqvvWbxTn1rE3z8iWZEcorK3VPM', - name: 'Test push notifications', - info: 'Test push notifications', - url: 'https://www.youtube.com', - icon: 'https://gateway.ipfs.io/ipfs/bafybeiarff4fukkj7fvmjuav6xvqzg5pfzyj2jcytzcbb5tdgyfzjfakfa/QmU7PC7yjdPfXJTgYuuqqvvWbxTn1rE3z8iWZEcorK3VPM', - processed: 1, - attempts: 0, - alias_address: '0x453552953C4e2732A38B93F7fB834e5AeF6F60f8', - alias_verification_event: - '{"aliasAddress": "0x453552953C4e2732A38B93F7fB834e5AeF6F60f8", "aliasBlockchainId": "80001"}', - is_alias_verified: 1, - alias_blockchain_id: '80001', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 5, - }, - { - id: 210, - channel: '0x8DaFfe9d1b5aDB33F53aDDC183C6b91F9cb30bc7', - ipfshash: 'bafkreiac6g3iul2uk6r6h2x5rsthgoq2y6uw23n4gzkvstfn7rl5tjq3v4', - name: 'PUSH for EthDenver', - info: 'Get notifications about everything EPNS at ETHDenver.', - url: 'http://ethdenver.epns.io/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeia2emdjy63kap2yqig3h4qlsjuawdby777osyr4rls2nyno2qsv6u/bafkreiac6g3iul2uk6r6h2x5rsthgoq2y6uw23n4gzkvstfn7rl5tjq3v4', - processed: 1, - attempts: 1, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 4, - }, - { - id: 809, - channel: '0x9dFe790B3baBCBD888dA7093017a0B7A68b99937', - ipfshash: 'QmbrQeT4FdvYRQDrDhVvZ9XMhs2TUNSA7UHc4M53vvNcKK', - name: 'Push-Graph Test', - info: 'This channel is to test subgraph notifications.', - url: 'https://push.org/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihniwj5eflkxah7feqdgjnfuoyeq5iw4ka7qze3h6hdxsydx3gx3e/QmbrQeT4FdvYRQDrDhVvZ9XMhs2TUNSA7UHc4M53vvNcKK', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-02-03T12:26:00.000Z', - blocked: 0, - counter: 18, - subgraph_details: '60+aiswaryawalter/push-graph-test', - subscriber_count: 4, - }, - { - id: 956, - channel: '0x85Cb63e3D8cEf31a421e59b6678bF0444Fa5d8BE', - ipfshash: 'QmUAgUYKteWdpcWkKmNtySGY5w7XkRpUYdYtqcSfEfXzLP', - name: 'Transfer PUSHNOTIFICATION', - info: 'Notification for Transfer', - url: 'https://push.org/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeidwsc4kws4fvzzsdj5e46re46qmwxmgidouhcfeel34xmhxbqbroe/QmUAgUYKteWdpcWkKmNtySGY5w7XkRpUYdYtqcSfEfXzLP', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 4, - }, - { - id: 967, - channel: '0xa45bdc5B11ce6F0952401bE35156398d8c40Ce64', - ipfshash: 'QmPWEKaJsfVweeyWT5bCftXDnbDFMgqw3sVpTnKtd3fH5a', - name: 'Push Graph Notif', - info: 'Subgraph notification test', - url: 'https://push.org/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihlt5qyhs3g3ii5vrrhb4evcsltoa6bssb2qiuh3bamxx4ndorkr4/QmPWEKaJsfVweeyWT5bCftXDnbDFMgqw3sVpTnKtd3fH5a', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-02-03T12:26:00.000Z', - blocked: 0, - counter: 18, - subgraph_details: '60+aiswaryawalter/push-graph-test', - subscriber_count: 4, - }, - { - id: 1425, - channel: '0x49403ae592C82fc3f861cD0b9738f7524Fb1F38C', - ipfshash: 'QmZ1t5upH5zHxvzefWppVNfv7ciacrDq9VUL3SZJ7trnNz', - name: 'SuperPush', - info: 'Create, Update and Delete Superfluid streams seemlessly and get alerted to your device with Push Notifications for every actions.', - url: 'https://www.superfluid.finance/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeibfnawzeadz7d2exw2ncbytanzwjb3mdkx74whga5b5scz6mmuymu/QmZ1t5upH5zHxvzefWppVNfv7ciacrDq9VUL3SZJ7trnNz', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 0, - verified_status: 0, - timestamp: '2023-02-18T21:02:50.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 4, - }, - { - id: 1659, - channel: '0x43097889162A9f2b7D85104f16aB7aB090056975', - ipfshash: 'QmQKuiR9nZw46pnrW16J7GZTsg3hteh93mWHcHV5Khrj24', - name: 'Push Protocol Demo', - info: 'A demo channel for testing out Push Protocol', - url: 'https://youtube.com', - icon: 'https://gateway.ipfs.io/ipfs/bafybeiaadvr565fk5mkam4hlmnaxdb7lxemfcffzqd24berqxw6sf3efny/QmQKuiR9nZw46pnrW16J7GZTsg3hteh93mWHcHV5Khrj24', - processed: 1, - attempts: 1, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-02-20T04:40:04.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 4, - }, - { - id: 287, - channel: '0x72F569DE6d77B1D4C3810767865FC706A1C39915', - ipfshash: 'bafkreidlxu5pnjeamnriukkqskv4v6ndfz5nifb2adrqwsvqiypg4oq4yi', - name: 'Push for DevConnect', - info: 'Stay upto date on all the happenings at DevConnect', - url: 'https://devconnect.org/schedule', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicgoxqjc3trzthp4chvdwyfe2nqm5lfaumkyztvm6vh6anwzztuty/bafkreidlxu5pnjeamnriukkqskv4v6ndfz5nifb2adrqwsvqiypg4oq4yi', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 369, - channel: '0x2b107f1B57F2A381dc8c09F8786FA3bdb3c70b27', - ipfshash: 'bafkreicnfx2wfjlphaoe7d3vttegbomdoc55n43p2r7wzpg2zzu2zcelrq', - name: 'Dapp Push notifications', - info: 'A channel to test out dapp push notifications', - url: 'animepahe.com', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihwyx4s5pv7afk7hskcvtz4j5o7yqkdwtb3t6mqsueqer4lbk53wy/bafkreicnfx2wfjlphaoe7d3vttegbomdoc55n43p2r7wzpg2zzu2zcelrq', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 445, - channel: '0x24a8E20a63DC3149BD7Ee136632161cDb8857522', - ipfshash: 'bafkreigglf54mwxxxzfhbexbyqgolyry4wfxkxvmxo3xojt6765rgi2r34', - name: 'Push Token Alerter', - info: 'Push Token alerter', - url: 'https://epns.io/', - icon: 'https://gateway.ipfs.io/ipfs/bafybeiaxnibay6ezfwmsytoiilcppa7piutbdzqzmm6vfcqi7wrmlx4qmm/bafkreigglf54mwxxxzfhbexbyqgolyry4wfxkxvmxo3xojt6765rgi2r34', - processed: 1, - attempts: 2, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 735, - channel: '0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F', - ipfshash: 'QmeMSv9UrL5znYJoLkJgKnivzaN67WnfCWB7donSx8AbXP', - name: 'Push x Polygon', - info: 'Push x Polygon Integration', - url: 'https://push.org', - icon: 'https://gateway.ipfs.io/ipfs/bafybeiejlm3hfthuprnxyqj4onxnm3gy2tuygubaaapgw2bdhuqhhqggq4/QmeMSv9UrL5znYJoLkJgKnivzaN67WnfCWB7donSx8AbXP', - processed: 1, - attempts: 0, - alias_address: '0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F', - alias_verification_event: - '{"aliasAddress": "0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F", "aliasBlockchainId": "80001"}', - is_alias_verified: 1, - alias_blockchain_id: '80001', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 737, - channel: '0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742', - ipfshash: 'QmZ3VQ87hNLeda2bgmvwZhKDaMgEboDVgGqTYktJGVNggG', - name: 'SeaLightPush', - info: 'Decentralized Exchange', - url: 'Https://SealightSwap.org', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicn4gmyg5gq3u3eoo5lbkuo4pbstrhw6uu2u6lgx6yd43e6zgxyg4/QmZ3VQ87hNLeda2bgmvwZhKDaMgEboDVgGqTYktJGVNggG', - processed: 1, - attempts: 0, - alias_address: '0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742', - alias_verification_event: - '{"aliasAddress": "0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742", "aliasBlockchainId": "80001"}', - is_alias_verified: 1, - alias_blockchain_id: '80001', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 929, - channel: '0x983d0aD6D9c8778889311bC0E45DE417E9D74a90', - ipfshash: 'QmcqBzru5FFJDvLk7SYGEFYhgz9bokU77DWL4Kzt3NEDEJ', - name: 'Push amplify', - info: 'This channel will be used to test Push amplify features, and UI changes.', - url: 'https://twitter.com/pranshu3196', - icon: 'https://gateway.ipfs.io/ipfs/bafybeihkrzovmnbscultfjfrnjqnsfqmrhrjuvnnokjwm35n7gcqy7xefi/QmcqBzru5FFJDvLk7SYGEFYhgz9bokU77DWL4Kzt3NEDEJ', - processed: 1, - attempts: 0, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 1039, - channel: '0xc092d5Aa8c23165484486F246C828e4980b6C707', - ipfshash: 'QmXc2CE1c9fR34HVmkwQNaHRUvt7YxtiUcJfpBSbKTyBzD', - name: 'testPushHack', - info: 'test', - url: 'https://iamzub.in', - icon: 'https://gateway.ipfs.io/ipfs/bafybeia6djth6wbxpkujkxuftbkeot6d6atnhtyfb5k3bn5metcyj2pk3q/QmXc2CE1c9fR34HVmkwQNaHRUvt7YxtiUcJfpBSbKTyBzD', - processed: 1, - attempts: 1, - alias_address: 'NULL', - alias_verification_event: null, - is_alias_verified: 0, - alias_blockchain_id: 'NULL', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, - { - id: 1241, - channel: '0x11EaB508c309595F14E363e6a8d434BEab91eEBC', - ipfshash: 'QmZm14LgHZB2hYHcENkJNhrrL11QRKDCpX3AeVmXEiy2Hq', - name: 'Test for push', - info: 'Test for push', - url: 'https://www.youtube.com', - icon: 'https://gateway.ipfs.io/ipfs/bafybeicnv3jv7ylfxqgb5cqyzzi4lumbjeqyimcljewqbexszjrqeqkn5m/QmZm14LgHZB2hYHcENkJNhrrL11QRKDCpX3AeVmXEiy2Hq', - processed: 1, - attempts: 0, - alias_address: '0x11EaB508c309595F14E363e6a8d434BEab91eEBC', - alias_verification_event: - '{"aliasAddress": "0x11EaB508c309595F14E363e6a8d434BEab91eEBC", "aliasBlockchainId": "80001"}', - is_alias_verified: 1, - alias_blockchain_id: '80001', - activation_status: 1, - verified_status: 0, - timestamp: '2023-01-03T16:38:31.000Z', - blocked: 0, - counter: null, - subgraph_details: null, - subscriber_count: 3, - }, -]; -``` - -</details> - ---- - -### **Opt in to a channel** - -```typescript -await PushAPI.channels.subscribe({ - signer: _signer, - channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP - userAddress: 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', // user address in CAIP - onSuccess: () => { - console.log('opt in success'); - }, - onError: () => { - console.error('opt in error'); - }, - env: 'staging', -}); -``` - -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| signer_ | - | - | Signer object | -| channelAddress* | string | - | channel address (CAIP) | -| userAddress* | string | - | user address (CAIP) | | -| verifyingContractAddress | string | - | Push communicator contract address| -| onSuccess | function | - | on success callback | -| onError | function | - | on error callback | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| - -<details> - <summary><b>Expected response (Opt in to channel)</b></summary> - -```typescript -// PushAPI.channels.subscribe | Response - 200 OK -{ status: 'success', message: 'successfully opted into channel' } - -``` - -</details> - ---- - -### **Opt out to a channel** - -```typescript -await PushAPI.channels.unsubscribe({ - signer: _signer, - channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP - userAddress: 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', // user address in CAIP - onSuccess: () => { - console.log('opt out success'); - }, - onError: () => { - console.error('opt out error'); - }, - env: 'staging', -}); -``` - -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| signer_ | - | - | Signer object | -| channelAddress* | string | - | channel address (CAIP) | -| userAddress* | string | - | user address (CAIP) | | -| verifyingContractAddress | string | - | Push communicator contract address| -| onSuccess | function | - | on success callback | -| onError | function | - | on error callback | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| - -<details> - <summary><b>Expected response (Opt out of a channel)</b></summary> - -```typescript -// PushAPI.channels.unsubscribe | Response - 200 OK -{ status: 'success', message: 'successfully opted out channel' } -``` - -</details> - ---- - -### **Sending notification** - -```typescript -async function sendNotification(options: { - senderType?: 0 | 1; - signer: any; - type: NOTIFICATION_TYPE; - identityType: IDENTITY_TYPE; - notification?: { - title: string; - body: string; - }; - payload?: { - sectype?: string; - title: string; - body: string; - cta: string; - img: string; - metadata?: any; - additionalMeta?: any; - }; - recipients?: string | string[]; // CAIP or plain ETH - channel: string; // CAIP or plain ETH - expiry?: number; - hidden?: boolean; - graph?: { - id: string; - counter: number; - }; - ipfsHash?: string; - env?: ENV; - chatId?: string; - pgpPrivateKey?: string; + isPublic: true, + account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', + env: 'staging', + pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key + scheduleAt: new Date("2024-07-15T14:48:00.000Z"), + scheduleEnd: new Date("2024-07-15T15:48:00.000Z") }); ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| senderType_ | number | 0 | 0 for channel notification. 1 for chat notification | -| signer* | - | - | Signer object | -| channel* | string | - | channel address (CAIP) | -| type* | number | - | Notification Type <br/>Target = 3 (send to 1 address), <br/>Subset = 4 (send to 1 or more addresses),<br/> Broadcast = 1 (send to all addresses) | -| identityType* | number | - | Identity Type <br/> Minimal = 0, <br/>IPFS = 1, <br/>Direct Payload = 2, <br/>Subgraph = 3 } | -| recipients* | string or string[] | - | for Notification Type = Target it is 1 address, <br /> for Notification Type = Subset, Broadcast it is an array of addresses (CAIP) | -| notification.title* | string | - | Push Notification Title (not required for identityType IPFS, Subgraph)| -| notification.body\* | string | - | Push Notification Body (not required for identityType IPFS, Subgraph)| -| payload.title | string | - | Notification Title (not required for identityType IPFS, Subgraph)| -| payload.body | string | - | Notification Body (not required for identityType IPFS, Subgraph)| -| payload.cta | string | - | Notification Call To Action url (not required for identityType IPFS, Subgraph)| -| payload.img | string | - | Notification Media url (not required for identityType IPFS, Subgraph)| -| payload.sectype | string | - | If Secret Notification then pass (not required for identityType IPFS, Subgraph)| -| graph.id | string | - | graph id, required only if the identityType is 3 | -| graph.counter | string | - | graph counter, required only if the identityType is 3 | -| ipfsHash | string | - | ipfsHash, required only if the identityType is 1 | -| expiry | number | - | (optional) epoch value if the notification has an expiry | -| hidden | boolean | false | (optional) true if we want to hide the notification | -| pgpPrivateKey | string | - | (optional) pgp private key for new notification verification proof | +| account_ | string | - | user address | +| spaceName* | string | - | group name | +| spaceDescription* | string | - | group description | +| spaceImage* | string | - | group image link | +| listeners* | Array<string> | - | wallet addresses of all listeners except speakers and spaceCreator | +| speakers* | Array<string> | - | wallet addresses of all speakers except listeners and spaceCreator | +| isPublic* | boolean | - | true for public space, false for private space | +| scheduleAt\* | Date | - | Date time when the space is scheduled to start | +| scheduleEnd | Date | - | Date time when the space is scheduled to end | +| contractAddressERC20 (deprecated) | string | null | ERC20 Contract Address | +| numberOfERC20 (deprecated) | int | 0 | Minimum number of tokens required to join the group | +| contractAddressNFT (deprecated) | string | null | NFT Contract Address | +| numberOfNFTTokens (deprecated) | int | 0 | Minimum number of nfts required to join the group | +| rules | Rules | - | conditions for space access (see format below) | +| pgpPrivateKey | string | null | mandatory for users having pgp keys| | env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -#### **Direct payload for single recipient(target)** +## **Rules format** ```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target - identityType: PushAPI.payloads.IDENTITY_TYPE.DIRECT_PAYLOAD, // direct payload - notification: { - title: `[SDK-TEST] notification TITLE:`, - body: `[sdk-test] notification BODY`, - }, - payload: { - title: `[sdk-test] payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - recipients: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // recipient address - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); -``` +export enum ConditionType { + PUSH = 'PUSH', + GUILD = 'GUILD', +} -#### **Direct payload for group of recipients(subset)** +export type Data = { + contract?: string; + amount?: number; + decimals?: number; + guildId?: string; + guildRoleId?: string; + guildRoleAction?: 'all' | 'any'; + url?: string; + comparison?: '>' | '<' | '>=' | '<=' | '==' | '!='; +}; -```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: 4, // subset - identityType: 2, // direct payload - notification: { - title: `[SDK-TEST] notification TITLE:`, - body: `[sdk-test] notification BODY`, - }, - payload: { - title: `[sdk-test] payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - recipients: [ - 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', - 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', - ], // recipients addresses - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); -``` +export type ConditionBase = { + type?: ConditionType; + category?: string; + subcategory?: string; + data?: Data; + access?: Boolean; +}; -#### **Direct payload for all recipients(broadcast)** +export type Condition = ConditionBase & { + any?: ConditionBase[]; + all?: ConditionBase[]; +}; -```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast - identityType: PushAPI.payloads.IDENTITY_TYPE.DIRECT_PAYLOAD, // direct payload - notification: { - title: `[SDK-TEST] notification TITLE:`, - body: `[sdk-test] notification BODY`, - }, - payload: { - title: `[sdk-test] payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); +export interface Rules { + entry?: { + conditions: Array<Condition | ConditionBase>; + }; + chat?: { + conditions: Array<Condition | ConditionBase>; + }; +} ``` -#### **IPFS payload for single recipient(target)** +<details> + <summary><b>Expected response (create space)</b></summary> ```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target - identityType: PushAPI.payloads.IDENTITY_TYPE.IPFS, // ipfs payload - ipfsHash: 'bafkreicuttr5gpbyzyn6cyapxctlr7dk2g6fnydqxy6lps424mcjcn73we', // IPFS hash of the payload - recipients: 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', // recipient address - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); -``` +// PushAPI.space.create | Response - 200 OK +{ + members: [{ + wallet: 'eip155:0x727C819feB2c7F99c66d71B8411521bca2010023', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSrssEBCACg3ZjrZB40Xqr5IKIEtFldaeQyJPNwDACMekY77yApav0B\n' + + 'RwiqhFJDFJKcprSHg/vYdqalAIGRQ+J98VMBtHweurIubD/ODB6WknOms7ZY\n' + + '3ummaEzyFRombuq/C75o/0ImCi2v0PJBI3kdpwzOjiTt8S44yoAVOcTf9jyg\n' + + 'vTEVCOM81yqCf0mDB4t0jqRYewlQuJegORXDKHKTfZcnQybBkDYUGgmxOcyF\n' + + 'BaPMhSiWqAAqqb4gcFO2QKq69JoiE9dzSuF/7dvAq2QZRogC/GQW2Q9yQbq3\n' + + 'CvMNO4H2KUZzegaq2s2nMPGMXPNf4GZcZVJE1phWgAnApxTf5kUFfKr1ABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKuywQQLCQcICZDwrCS5ulOLwQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBFKpO7zcSRed+QmbIfCsJLm6U4vBAABZMwf+OIbBcFQ7x++1\n' + + 'NINOYbP9v0PyJvpllDcUORbk3uiPMpvDuQYAe2Fd4dY2Y91l3VdpIm/w6HQy\n' + + 'y81Y694w4E7PRVhDwHivv5D10VE9MF3h6qOHrLLpvdhpMaB5Ur8ts5rU2zOu\n' + + '64HR04/BVO9N0nrE9iywIgVMOy6IrS+OgK3r75PPX35bam/kbbmZHeygFaE9\n' + + '+mgQVdhwgF5borekIiz1Rc8CPA/P1yZy8QQl4KGmJEs+hOc5rPnUWwarvaAH\n' + + 'mPb6H0/mG81eXBOjpJlSFu6d/uqKLpoAw5fkvFoIsNwovYpyQkSbhzwe4T2N\n' + + 'jGqGd0+La03QdB5FbaiwcnJ96lU6oM7ATQRkq7LBAQgAxu9uK1+p62+/RvcF\n' + + 'Mz7g3A8SJiN76NYxk29sjQ9gW74B/IdPv5TlUVhG6PGr2c3SucASlEHieagY\n' + + 'CXM2+fpdu4rQ6EKRAe+30GFopfzhX1d0zv9d5BE6q1ML5mkrpDECH5iuqah7\n' + + 'smmbRdWE7zRSGaHyEfVqAG3wfMzzN0BcchxxR4vMCNKYLs9v2Q09ecO7DgaY\n' + + '5CZqxaFlTo+auuDhE0XU7WRbNL77izocV1Sm+McRyo28PrFTcrRRznD1nP0V\n' + + 'eZ4+aoulqyYA+gBBaIUdSA5kQXJiy67crB50yX3V6zLIfptD2ThHPjTY/inW\n' + + 'wVHVug4jIWUQ1QQw/q9qvGxAzQARAQABwsB2BBgBCAAqBYJkq7LBCZDwrCS5\n' + + 'ulOLwQKbDBYhBFKpO7zcSRed+QmbIfCsJLm6U4vBAADu6wf+NJDX/3NAxQKN\n' + + 'Iigj0GkBm/y69iFmQvWJxxtiYCNu8VBhm8MkcghUJ8G2tWP9ueUOM8sMTEa+\n' + + 'G+l+wSNwh/1yisF3FutDpy6l+fiy6kPPD4vl08jY3GrqSuWWfMxTJhMZ5D6v\n' + + 'OW2EfdyET+oP5eOnCd6p0EXP2ic48rVHDdU2iWeg0RkGvZP3t2LljWFdLbvw\n' + + 'h7+wSD1i4LY4slUIdbLdDSLN1gWFN1HXzX10mpX0grV2sBdfkNyHhF0WcIat\n' + + 'sD9HpAx2M62yP2D9D9UZVrW7WfmOoyL1NrnXSJsI8CRFDzujvpIrr7875zSi\n' + + 'VnxDVyt7twc7cYqRDHsNYuxAuE815A==\n' + + '=2jvb\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA4klEQVR4AcXBoW3FMBRA0dsn75E9skAU6BkMSk1CA0xNsoBnMLSyQPbIDgVlLX0OcPX1Vb1zPj6/v35QWg5o61bQok+MHHVHazmgrVtBE4wJxgRjjofzmuj4xCuiT2iRCe2gJxgTjAnGXMuBTi2MRJ8YOerOSMsBTTAmGBOMuXUraNEntKPuaEfdeUX0iU4taIIxwZhgzPGH6BP/STAmGBOMOR6W+UY7r4l3LPONttITjAnGBGMu+kSnFrQlB96xbgUt+oQmGBOMCcYcDy0HRs5rYmSZb7SWA1pkQhOMCcYEY78uSjTZAXCkaQAAAABJRU5ErkJggg==' + }], + pendingMembers: [{ + wallet: 'eip155:0x5f4e9e7Fcc17a943178c0b0881b09E8Ef9D34437', + publicKey: null, + isSpeaker: false, + image: null + }, + { + wallet: 'eip155:0xFedfA2b276676C5c6ce753ddb4B05d00104E9236', + publicKey: null, + isSpeaker: false, + image: null + } + ], + contractAddressERC20: "0x8Afa8FDf9fB545C8412499E8532C958086608b30", + numberOfERC20: 20, + contractAddressNFT: "0x42af3147f17239341477113484752D5D3dda997B", + numberOfNFTTokens: 2, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkq7LBCZDwrCS5ulOLwRYhBFKpO7zcSRed+QmbIfCsJLm6\n' + + 'U4vBAAAAHwf+K4f0gxaP56X4Cv2zlPWB9iUPi/1FOnx8ZF7oEf9xJSv/xA7v\n' + + '9LHBTZ2Y9AQlJpy0WLB7KGF7mVV1MdUKHjn2SFQ+1h+8d+FIHXfmB7Ie4alP\n' + + 'nnar6XjtMVKYyqXRzMzCq2F7Fjea1sUOXBxAeyJstAGG6nvsU51imaAtGQlQ\n' + + 'u7ih8D9UkiOe719v5GyI1vtiS+hHGlYo0+A7WVImH6SuVyPZ3UyPvLxXpeKs\n' + + '1SeEfuvfmKHbswm1DDGOknyo7fJ/QgKqOfkwsBIrYRNGwPGEKt8pHdwNxsNn\n' + + 'hNQtlFqtmtvieaxbhJQKXHbVgNv206xNsUBrK/U2nCakx7EMmxikFg==\n' + + '=tz9T\n' + + '-----END PGP SIGNATURE-----\n', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'wasteful_indigo_warbler', + isPublic: true, + spaceDescription: 'boring_emerald_gamefowl', + spaceCreator: 'eip155:0x727C819feB2c7F99c66d71B8411521bca2010023', + spaceId: 'spaces:e0553610da88dacac70b406d1222a6881c0bde2c5129e58b526b5ae729d82116', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'PENDING', + rules: { + 'spaceAccess': { + 'conditions': [ + { + 'any': [ + { + 'type': 'PUSH', + 'category': 'ERC20', + 'subcategory': 'holder', + 'data': { + 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1000, + 'decimals': 18 + } + }, + { + 'type': 'GUILD', + 'category': 'guildRoles', + 'subcategory': 'specificRole', + 'data': { + 'guildId': '13468', + 'guildRoleId': '19924' + } + } + ] + } + ] + } + } +} -#### **IPFS payload for group of recipients(subset)** -```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.SUBSET, // subset - identityType: PushAPI.payloads.IDENTITY_TYPE.IPFS, // ipfs payload - ipfsHash: 'bafkreicuttr5gpbyzyn6cyapxctlr7dk2g6fnydqxy6lps424mcjcn73we', // IPFS hash of the payload - recipients: [ - 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', - 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', - ], // recipients addresses - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); ``` -#### **IPFS payload for all recipients(broadcast)** +</details> -```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast - identityType: PushAPI.payloads.IDENTITY_TYPE.DIRECT_PAYLOAD, // direct payload - ipfsHash: 'bafkreicuttr5gpbyzyn6cyapxctlr7dk2g6fnydqxy6lps424mcjcn73we', // IPFS hash of the payload - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); -``` +--- -#### **Minimal payload for single recipient(target)** +### **To check user access of a token gated space** ```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target - identityType: PushAPI.payloads.IDENTITY_TYPE.MINIMAL, // Minimal payload - notification: { - title: `[SDK-TEST] notification TITLE:`, - body: `[sdk-test] notification BODY`, - }, - payload: { - title: `[sdk-test] payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - recipients: 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', // recipient address - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address + +// actual api +const response = await PushAPI.space.getAccess({ + spaceId:'8f7be0068a677df166c2e5b8a9030fe8a4341807150339e588853c0049df3106', + did: '0x9e60c47edF21fa5e5Af33347680B3971F2FfD464' env: 'staging', }); ``` -#### **Minimal payload for a group of recipient(subset)** +Allowed Options (params with \_ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| spaceId | string | - | space address | +| did | string | - | user address | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + +<details> + <summary><b>Expected response (space access)</b></summary> ```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.SUBSET, // subset - identityType: PushAPI.payloads.IDENTITY_TYPE.MINIMAL, // Minimal payload - notification: { - title: `[SDK-TEST] notification TITLE:`, - body: `[sdk-test] notification BODY`, - }, - payload: { - title: `[sdk-test] payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - recipients: [ - 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', - 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', - ], // recipients address - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); +// PushAPI_chat_getSpaceAccess | Response - 200 OK +{ + 'spaceAccess': true, + 'rules': { + 'spaceAccess': { + 'conditions': [ + { + 'any': [ + { + 'type': 'PUSH', + 'category': 'ERC20', + 'subcategory': 'holder', + 'data': { + 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1000, + 'decimals': 18 + }, + 'access': false + }, + { + 'type': 'GUILD', + 'category': 'guildRoles', + 'subcategory': 'specificRole', + 'data': { + 'guildId': '13468', + 'guildRoleId': '19924' + }, + 'access': true + }, + { + 'type': 'PUSH', + 'category': 'ERC721', + 'subcategory': 'owner', + 'data': { + 'contract': 'eip155:5:0x42af3147f17239341477113484752D5D3dda997B', + 'amount': 1 + }, + 'access': true + } + ] + } + ] + } +} + ``` -#### **Minimal payload for all recipients(broadcast)** +</details> -```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast - identityType: PushAPI.payloads.IDENTITY_TYPE.MINIMAL, // Minimal payload - notification: { - title: `[SDK-TEST] notification TITLE:`, - body: `[sdk-test] notification BODY`, - }, - payload: { - title: `[sdk-test] payload title`, - body: `sample msg body`, - cta: '', - img: '', - }, - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); -``` +--- -#### **Graph payload for single recipient(target)** +### **To update space details** -**_Make sure the channel has the graph id you are providing!!_** +Note - updateSpace is an idompotent call ```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.TARGETTED, // target - identityType: PushAPI.payloads.IDENTITY_TYPE.SUBGRAPH, // Subgraph payload - graph: { - id: '_your_graph_id', - counter: 3, - }, - recipients: 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', // recipient address - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', -}); -``` - -#### **Graph payload for group of recipients(subset)** +// pre-requisite API calls that should be made before +// need to get user and through that encryptedPvtKey of the user +const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); -**_Make sure the channel has the graph id you are providing!!_** +// need to decrypt the encryptedPvtKey to pass in the api using helper function +const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); -```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.SUBSET, // subset - identityType: PushAPI.payloads.IDENTITY_TYPE.SUBGRAPH, // graph payload - graph: { - id: '_your_graph_id', - counter: 3, - }, - recipients: [ - 'eip155:5:0xCdBE6D076e05c5875D90fa35cc85694E1EAFBBd1', - 'eip155:5:0x52f856A160733A860ae7DC98DC71061bE33A28b3', - ], // recipients addresses - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', +// actual api +const response = await PushAPI.space.update({ + spaceId: 'spaces:e0553610da88dacac70b406d1222a6881c0bde2c5129e58b526b5ae729d82116', + spaceName: 'Push Space 3', + spaceDescription: 'This is the oficial space for Push Protocol', + listeners: ['0x2e60c47edF21fa5e5A333347680B3971F1FfD456','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + spaceImage: <group image link> , + speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: PushAPI.ChatStatus.PENDING, + account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', + env: 'staging', + pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key }); ``` -#### **Graph payload for all recipients(broadcast)** +### **To update token gated space details** -**_Make sure the channel has the graph id you are providing!!_** +Note - updateSpace is an idompotent call ```typescript -// apiResponse?.status === 204, if sent successfully! -const apiResponse = await PushAPI.payloads.sendNotification({ - signer: _signer, - type: PushAPI.payloads.NOTIFICATION_TYPE.BROADCAST, // broadcast - identityType: PushAPI.payloads.IDENTITY_TYPE.SUBGRAPH, // graph payload - graph: { - id: '_your_graph_id', - counter: 3, - }, - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // your channel address - env: 'staging', +// pre-requisite API calls that should be made before +// need to get user and through that encryptedPvtKey of the user +const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); + +// need to decrypt the encryptedPvtKey to pass in the api using helper function +const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); + +// actual api +const response = await PushAPI.space.update({ + spaceId: 'spaces:e0553610da88dacac70b406d1222a6881c0bde2c5129e58b526b5ae729d82116', + spaceName: 'Push Space 3', + spaceDescription: 'This is the oficial space for Push Protocol', + listeners: ['0x2e60c47edF21fa5e5A333347680B3971F1FfD456','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + spaceImage: <group image link> , + speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: PushAPI.ChatStatus.PENDING, + rules: { + 'entry': { + 'conditions': [ + { + 'any': [ + { + 'type': 'PUSH', + 'category': 'ERC20', + 'subcategory': 'token_holder', + 'data': { + 'address': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1000, + 'decimals': 18 + } + }, + { + 'type': 'GUILD', + 'category': 'guildRoles', + 'subcategory': 'allRoles', + 'data': { + 'guildId': '13468' + } + } + ] + } + ] + }, + 'chat': { + 'conditions': [ + { + 'all': [ + { + 'type': 'PUSH', + 'category': 'ERC20', + 'subcategory': 'token_holder', + 'data': { + 'address': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1000, + 'decimals': 18 + } + }, + { + 'type': 'GUILD', + 'category': 'guildRoles', + 'subcategory': 'specificRole', + 'data': { + 'guildId': '13468', + 'guildRoleId': '19924' + } + } + ] + } + ] + } + }, + account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', + env: 'staging', + pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key }); ``` +Allowed Options (params with _ are mandatory) +| Param | Type | Default | Remarks | +|----------|---------|---------|--------------------------------------------| +| spaceId_ | string | - | Id of the space | +| account* | string | - | user address | +| spaceName* | string | - | space name | +| spaceDescription* | string | - | space description | +| spaceImage* | string | - | space image | +| status* | string | - | space status - 'ACTIVE', 'PENDING', 'ENDED' | +| listeners* | Array<string> | - | wallet addresses of all listeners except speakers and spaceCreator | +| speakers* | Array<string> | - | wallet addresses of all speakers except listeners and spaceCreator | +| scheduleAt* | Date | - | Date time when the space is scheduled to start | +| scheduleEnd | Date | - | Date time when the space is scheduled to end | +| contractAddressERC20 (deprecated) | string | null | ERC20 Contract Address | +| numberOfERC20 (deprecated) | int | 0 | Minimum number of tokens required to join the space | +| contractAddressNFT (deprecated) | string | null | NFT Contract Address | +| numberOfNFTTokens (deprecated) | int | 0 | Minimum number of nfts required to join the space | +| rules | Rules | - | conditions for space and chat access (see format above) | +| pgpPrivateKey | string | null | mandatory for users having pgp keys| +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + <details> - <summary><b>Expected response (Send Notification)</b></summary> + <summary><b>Expected response (update space)</b></summary> ```typescript -// PushAPI.payloads.sendNotification | Response - 204 OK +// PushAPI.space.update | Response - 200 OK +{ + members: [ + { + wallet: 'eip155:0x367c6555b2CAD9C2d2656066EC3996Ba12cD058d', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSr17UBCADhEXWz/lsg0sDA+QRygzl+4t84/YYa459nzFRNB36jkbU8\n' + + 'FxRsE6oZTu0Leanup7aul4trJJ4qyA6xFfDjprDzrm1Gtp/gos46Lxk+br64\n' + + 'lzgqTfSKpBs9UWqOcr4Vnoq9WeOiFZax0DhN//7ibIQDWIJ0E6iOc8uiSoGZ\n' + + 's4AHTx7GtUvHxIUAk/hQY8UjjDNyhgCSrmdPeWt/SVbmFCHchdH/KhSK8JVq\n' + + 'qs8/nKx2Tm/nmAdWFZDqIJxd5tVuXXMxTZYZADZfmBltR2F/8GkF7hfX/aOo\n' + + 'gGQ/u2FPbCKRjtedfJi3WsPUKtyFg6QdwBnOQmYn0fGXlPGR7UVSsmIVABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKvXtQQLCQcICZD2NRrvru2XMgMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBM1nsbalDm3PtLAK2/Y1Gu+u7ZcyAADzuwgAmTBbnBQZ2w06\n' + + 'RbLmcZf8cYTof1X3mpYBa1lprMltib2jZQdu8DxhZBapYIE1O0UzV2Dy8IXj\n' + + 'zavtNFZiLR8FTwkrXQ3DGrZylnqjLkQ6m2jZsGIypb2OpTlBIBnjW98Dh99F\n' + + 'egI/5wse59IfGhYXVcKluKDAW2ezUJx8BhacZCwf/S8iG9YKrZctS5cVZxQw\n' + + 'SymXv88msoQrWhxmu2AT0rNsZ656ANMr/MuUjKMxQsoNCNIkp5kE0UTGfMwc\n' + + 'c69Gabs9uOPOqAGeSBGVfw+uJig/RJ4MWDCbj6QIDsV5FFRvTmJmmSNLNH5y\n' + + '83pHxE+923z6NiPWRonbns3pFNvhnc7ATQRkq9e1AQgAxjGMkGhs2OTW8fW/\n' + + '4tloJOID0UIDrz/24uX4JU+qjTqMzFyNGaNagT8n0xDH2E63YFmketip4QA2\n' + + '6kUBICKR2Y5kNNzkJXK4NYfa5OXEIS+lw+X7oMXd9YJ/D1fig1XD4Bf0ofsZ\n' + + 'QIxHOn6w3T/wQHOBpu+cqE3d0pW+6s6hZ4mkuPk6OXrkBSEtynk4ADQS+a3b\n' + + 'PrCGU9rJy2OnbP+lMr3onv/6BR/DFE4qCIfQt0cLu4nhAuYVYrOupi3p9eBQ\n' + + 'z/oWHCSNQVQSW2/vHp0YwMj2r3jSGdoZ3pcfy4iXOa7xEyeauOn/pHK+syOX\n' + + 'Pv64DHncql4AJFj9tw4rZ2/kkQARAQABwsB2BBgBCAAqBYJkq9e1CZD2NRrv\n' + + 'ru2XMgKbDBYhBM1nsbalDm3PtLAK2/Y1Gu+u7ZcyAADapwf/XF6I2NifyL/h\n' + + '2aVsr2lL2At732336je3WM6QnA/q1x9lmxX646c9eETUQvLLhT5RZmx1X8Fa\n' + + 'X/qGMKJe+BWLFPy5k6LnOezvvOxHGV+dzRndlWbnC9d3AZhThciw/Rd8V9W6\n' + + 'd6luo7+Apdd3rS17hG4gElhNX1drq5TuWR89yxA5oXcIqA+u3jBdpz0qo/ME\n' + + '+63r0AubixdM7rgV0skugaIXvqMKtfMC/V2A8mCL5AmRXCyfMBIsEA0L5YA1\n' + + 'wsKlHIQAy3jiPdY/2q5KUWJsR9o/IFirjnTd5vywtYsscOq/KnfLKdc2cVOr\n' + + 'e/vSkTOrD+dVTlxGhADoud4kvcOPtg==\n' + + '=6H2/\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBMU5DMRBF0cvI63FJETn7oXY3K3CBNHX2g/WFKKdnLdCOUnyEgnjnPH2+v35RXPagOsbmEZc9qI6xqQwxQ8wQa9w5xuYvHWNzxhAzxAyxxg8ynKrPxZkMp+pzccYQM8QMsZbhVH0uzmQ4j8hwKkPMEDPEWp+LKsOp+lxUGc6ZPhdVhlP1uagMMUPMEGsZzn/KcCpDzBAzxBp3+lxUGU718vzGmVtcqfpcVBlOZYgZYoZY63PxG7ePK4/oc1EZYoaYIfYN05Y0ReqpB6sAAAAASUVORK5CYII=' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0xB026B0A8BB1fea997a73c5a84fe7aF8cAab1AcF2', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA4ElEQVR4AcXBsU0EMRCG0Y+RC3ETzpwheqAFOnBmOZtSNqGC02abOaUAdwLp3AU+IYT+916+Pj6/CXLp/Kc1B5EhZogZYokn1hxEuXR21hxEuXR2DDFDzBBLuXSiNQdRaxeR+2CntYvIfRDl0okMMUPMEEs8cZw37pQbO8fJnUVlxxAzxAyxxINcOtGag7/IpbNjiBlihlh6f30jcq9EuXSiNQc7uXSiNQdRaxeRIWaIGWLJvRK1dhEdJ3dy6fxGaxeReyUyxAwxQyzxwL0SLSpRLp2dNQeRT7YMMUPMEPsB1yM4zt7CMugAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x9b70FD7164ec0Ed3E1B3E318836522340dd2e125', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0UlEQVR4AcXBMWoDMRRF0ZtnkWYKgddgGKbSVrSILFBbUWUMLrICgwqXQ9L+NDKDIe+cj8+v7x+CPhpRyZV39NGISq5EwkyYCbN0f9z4a2Omj8ZMyZVo2Tei++NGJMyEmTBLz9OVqOTKTMmVIy7nlaiPRiTMhJkwS8u+8Z+WfSMSZsJMmKXLeWWmj0a07Bszz9OVqORKdDmvRMJMmAmzxAslV45ZOUKYCTNhlvpozJRcifpozJRcifpozAgzYSbMEi/00YhKrsz00ThCmAkzYfYLlLsvpsHyBx0AAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x1A050099a08D7faf3b5923669a0FAe42A0872D72', + publicKey: null, + isSpeaker: false, + image: null + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkq9e1CZD2NRrvru2XMhYhBM1nsbalDm3PtLAK2/Y1Gu+u\n' + + '7ZcyAAA0igf/Tgo/WU4C5g4UtHPCwU/jThQwjElzCa96bZU8bCXsgnoO1NMI\n' + + 'fwI7FxIw8FmFrktHIWT10T/9vq2ItyUvpbWRhnD5zt5aRhJ1KA1z06iwkoUt\n' + + 'DLiPfveoSDyIhUIjx5PUMN0r/tXmLhj3CrkHx1hiPBxEkhi9brfFcOvX57HS\n' + + 'VOKOeeUa4G1cmk6dtzLHWT4p7ekrFhZPHXDtZUMZEU2wbMkB6bRqlZ7UYLbN\n' + + '7+0AvCu7uaCYG0zfbl3oZc6DkIm9jnBknsII6Hqv7Dc9NLAUBWo8tPrW2/KN\n' + + '8Bv/gk5HPb16tOihIUjs8v45wO3oTPAQYbJGdF6ta+HyiKO8JWipbw==\n' + + '=wkHz\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'mobile_aquamarine_constrictor', + isPublic: true, + spaceDescription: 'conventional_crimson_dove', + spaceCreator: 'eip155:0x367c6555b2CAD9C2d2656066EC3996Ba12cD058d', + spaceId: 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'PENDING', + rules: { + 'spaceAccess': { + 'conditions': [ + { + 'any': [ + { + 'type': 'PUSH', + 'category': 'ERC20', + 'subcategory': 'token_holder', + 'data': { + 'address': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + 'amount': 1000, + 'decimals': 18 + } + }, + { + 'type': 'GUILD', + 'category': 'guildRoles', + 'subcategory': 'specificRole', + 'data': { + 'guildId': '13468', + 'guildRoleId': '19924' + } + }, + { + 'type': 'PUSH', + 'category': 'ERC721', + 'subcategory': 'nft_owner', + 'data': { + 'address': 'eip155:5:0x42af3147f17239341477113484752D5D3dda997B', + 'amount': 1 + } + } + ] + } + ] + } + } +} ``` </details> --- -### Notification Helper Utils - -#### **Parsing notifications** - -Utils method to parse raw Push Feeds API response into a pre-defined shape as below. +### **To get space details by spaceId** ```typescript -// fetch some raw feeds data -const apiResponse = await PushAPI.user.getFeeds({ - user: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // user address - raw: true, +const response = await PushAPI.space.get({ + spaceId: + 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', env: 'staging', }); -// parse it to get a specific shape of object. -const parsedResults = PushAPI.utils.parseApiResponse(apiResponse); - -const [oneNotification] = parsedResults; - -// Now this object can be directly used by for e.g. "@pushprotocol/uiweb" NotificationItem component as props. - -const { - cta, - title, - message, - app, - icon, - image, - url, - blockchain, - secret, - notification, -} = oneNotification; -``` - -_We get the above `keys` after the parsing of the API repsonse._ - ---- - -### Advanced Notifications (WIP) - -### DEPRECATED - -#### **Get a channel's subscriber list of addresses** - -```typescript -const subscribers = await PushAPI.channels.getSubscribers({ - channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', // channel address in CAIP - page: 1, // Optional, defaults to 1 - limit : 10 // Optional, defaults to 10 - env: 'staging' -}); ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| channel_ | string | - | channel address (CAIP) | +| spaceId_ | string | - | space id | | env | string | 'prod' | API env - 'prod', 'staging', 'dev'| <details> - <summary><b>Expected response (Get channel's subscribers list)</b></summary> + <summary><b>Expected response (get space by space id)</b></summary> ```typescript -// PushAPI.channels.getSubscribers | Response - 200 OK +// PushAPI_space_get | Response - 200 OK { - "itemcount": 11, - "subscribers": [ - "0x1d4f52775344f9a32093af0ccd03a4fb6dac8e30", - "0x28d615edd8404f8ca1e0271a0b5a48171589921a", - "0x4352639b99689069f9b0b847eee349c3c1b0706c", - "0x50029e62540537045bcfd3d320483865344edb33", - "0x5ac9e6205eaca2bbba6ef716fd9aabd76326eeee", - "0x778d3206374f8ac265728e18e3fe2ae6b93e4ce4", - "0xa44f2994750cf774eab05751d90ade4dedabe7fe", - "0xbcfb7da1dcf40e8cfb331683bb7d6f4eba091b08", - "0xcf5dbf241fc65a5af56c95101ac4e9ec2c57d941", - "0xd8634c39bbfd4033c0d3289c4515275102423681" - ] -} -``` - -</details> - ---- - -## For Video - -### **Instance Variables** - -#### **peerInstance** - -- Used to store the simple peer instance used for the webRTC connection. - -```typescript -private peerInstance: any = null; -``` - ---- - -#### **signer** - -- Used to store the signer of a user. -- Used in the request, acceptRequest and disconnect methods to send notifications. - -```typescript - private signer: SignerType; -``` - ---- - -#### **chainId** - -The chain id of the chain on which the call is being conducted. - -```typescript - private chainId: number; -``` - ---- - -#### **pgpPrivateKey** - -- Used to store the PGP private key of a user. -- Used in the request, acceptRequest and disconnect methods to send notifications. - -```typescript - private pgpPrivateKey: string; -``` - ---- - -#### **env** - -- The environment on which the call is being conducted. - -```typescript -private env: ENV; -``` - ---- - -### **data** - -- Stores data related to the video call. - -```typescript -export type IMediaStream = MediaStream | null; - -export enum VideoCallStatus { - UNINITIALIZED, - INITIALIZED, - RECEIVED, - CONNECTED, - DISCONNECTED, - RETRY_INITIALIZED, - RETRY_RECEIVED, -} - -export type PeerData = { - stream: IMediaStream; // incoming media stream - audio: boolean | null; // incoming audio status - video: boolean | null; // incoming video status - address: string; // incoming address - status: VideoCallStatus; // status for the connection with incoming peer - retryCount: number; // number of retires done -}; - -export type VideoCallData = { - meta: { - chatId: string; // unique chatId for the corresponding push w2w chat - initiator: { - address: string; // initiator's address - signal: any; // initiator's signaling data for webRTC connection - }; - broadcast?: { - livepeerInfo: any; - hostAddress: string; - coHostAddress: string; - }; - }; - local: { - stream: IMediaStream; // local media stream - audio: boolean | null; // local audio status - video: boolean | null; // local video status - address: string; // local address - }; - incoming: [PeerData]; -}; - -private data: VideoCallData; -``` - ---- - -#### **setData** - -- This function can be used to update the video call `data` - -```typescript -setData: (fn: (data: VideoCallData) => VideoCallData) => void; - -// usage - -import { produce } from 'immer'; - -setData((oldData) => { - return produce(oldData, (draft) => { - // update the draft object, example - draft.incoming.status = VideoCallStatus.INITIALIZED; - }); -}); + members: [ + { + wallet: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSr528BCADI8kQcWkaw9PKmSrwCtPBDWj+wzPhmok9jAzxzb2+qAjSV\n' + + 'rYdIrnx6PAp1rMU6qoVg4cdDbCYPV+kCj8l3lUzH/a/SfPsDWpspA/ICWMeS\n' + + 'dMdGYxHLk2gsu0wRz69qoddXMY1h5eMZEyRnr2fsX/cy15mxO2IEHYnC2/rp\n' + + '06iFpx1T8k5HWgFDpyleWyMSQ7Bnn7GutrlHYEVtIGVfXDSkea8IDLLkzBEV\n' + + '3jlBUFhpsrlcvDwDYcMYOrqSBEtg1a+GMK+2Ye/hF37KUYTAPleKXeN0cYIs\n' + + 'Va8oleZK960XYfuy5SYCJav2kaAggNWQBie5G9C4H3h7FuFwWk8LH3DhABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKvnbwQLCQcICZBm9Bz6DvB6DwMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAAAkiQgAukm3owebckwr\n' + + 'xAR42r/+CBx1uoqM2ZeEAUeYtBF7sdLEsdxFrxl8wHKAbglZwtgWcfG95v2R\n' + + 'zLcBco3v9p0IuS6DZduIfhngZ49gpYwqFGyiCOvo+k14tuMbrbOZTTKp0uc6\n' + + 'icpTyP8/1U0nZrQmmSXyfh6Hgmx1OnW3zTM7oUN1ZVvj3V6rOl+ktUPjAaYo\n' + + 'CWJjth92xhDWEPZnC/4Gz2eRoTVtmx8u+/2vNPffQVgzzHznUxB+G5XeZmPk\n' + + 'z8oxxSxII8PNiAs5LizqPjyq2gEv25GlCsMXTYz60n/t/4G7Yc94yu8xD8u3\n' + + 'BpWluHC2eW0pYFcDfiNLfv0uJCrUcM7ATQRkq+dvAQgA7v7Zz4CZdPsd4jvB\n' + + 'uDwjop/Gvoz+rbvAdS3Xrsi+OTyrWAqidnXChhwExlUNelZ9v52lGxe1twwr\n' + + 'vxeQ4M0pv4oqSlZxhkqBCyj+E7ECR2WXG7ccLlzYOz3b5BXT+fEkmVsbVTjA\n' + + 'Kttjosm7FtY4igY2Hu4UlZZW8M1tYL1R/UegFeMYGY7aO7dcKeiP0NsDwm3c\n' + + '0SiU6/JlOXAIi/ZSKDJ4b5BPK6GFj5pNWr92/V7LejlZfoHAVDbb91tiPGdP\n' + + 'y3+r9T3IYsgUDLgOpPQn6o82Nctm6CnIZqAN12nJ1DEJP2JyLDedg9b5H+aa\n' + + 'FDZFc7yQ3In/QPtjHImydLt9NwARAQABwsB2BBgBCAAqBYJkq+dvCZBm9Bz6\n' + + 'DvB6DwKbDBYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAABRUQf+KoF4UXuseLBO\n' + + 'd0PD0+hEcnsYbaPWmPZtJPWusxPl6kt421luymPiThDXwaMVzRrmxkz0dNZ3\n' + + 'bUFYtS24t2BhlXZ6cGFNRjXrA9OV0kLg/kNm1vboQ1GL8qRV9CIjPVEpksQp\n' + + 'tOiYN+X+/2XdPJkaQpITHIFV067qWQSAKIonvOI8OJYOovGRQTInz0VE71Yn\n' + + 'SeiOilKBK+p2RN38jGr0PGWt740KJ6560FzfUwTAQzz9vrkYa+vEhWe+bzOd\n' + + 'YBpxj/BRTGR19DrKlGcFPdTYz5ADxCjBuCxXgoRCbBiWwh+iIstk5qkT8uHK\n' + + 'NQjzDvo3RO1cROQp0zsikladmzGZHQ==\n' + + '=q/e/\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA10lEQVR4AcXBsWnFMBSG0c8/brOD9kgfogHUGQIuAppInSsVAQ2gdbSD64fTXl4hMI/HPWf5fXxf3DDaxkxIlTuEM+FMOFt5MtqG1XvBipGpsp9YMWaskCqWcCacCWfL4+fzwogx8069FyzhTDgTzpavv3oxEVLlFaNtzAhnwplwtvIkpIpV9hMrxsxM7wUrHxVrtA1LOBPOhLM1pIo12oaVj4rV98JMPj6wRtuwQqpYwplwJpyt3BRjZiZQuUM4E86Es7XsJ1aMTIVUeUXZTyzhTDgTzv4BnGY033BWusUAAAAASUVORK5CYII=' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0xaC6C69c657cF6022fa787B14BDdaA22936B56D65', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA2UlEQVR4AcXBQWoEIRBA0Z+ikOwNDHirbARPKDiLvkzOIATaC4iQbGt6ITSzqPc+np8/fxhpVazzcfCOr99vrK4FS3AmOBOcKRddCy9GwQoxszNHw+rKluBMcCY407QqO10L1hyNO9Kq7AjOBGeCMz0fB9YcjZ20KjtdC1bXghVixhKcCc4EZzpH446uhXfM0bAEZ4IzwZmGmLHmaOyEmNmZo7ETYsYSnAnOBGfKRVoVq2vBmqNxR1oV6+SV4ExwJjhTLroWdkLM7MzRsLoWrMCBJTgTnAnO/gGd1jrTKk/8EAAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xEf532414907E8c631307c0d501cDe6D1694bAF5e', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBobHDMBBF0ZsdjftIDeGuIkzIaGsQC1MNQkZirsLcnaQCk3yqBOzMH4N3zu11f38I+GPiinacRAwxQ8wQS/zo1flSGqNenUgujVGvziiXxsgQM8QMscSPXBqjXp1RLo1Ir84ol0bEEDPEDLHkj4lI51uvzn/4YyJiiBlihlhqx0lkZ2U0Pxci+7YyasdJxBAzxAyx1KsT8W3lil6diCFmiBlit9f9/SHQq3NFLo2IIWaIGWKpVyeybyuj+bkQ2beV0VwXIoaYIWaI/QH8GTSs76EUEQAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x2F5f27B523C8888eA79b7FA80a9CbA6b6980784c', + publicKey: null, + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW3DQAxA0W9CExjIDhogfboDCw9gICvcHmldcIAMoYLgJJ5CKzgto4KA4ILvXT5+Pl8kwydZqJHt60bl+ryRDZ9koUYmNBOaCc0u31+/L04INSrDJ2cIzYRmQrMl1Dhj+KQSapwhNBOaCc0WDvZ1o+ROZV83KtfnjUxoJjQTmi0c3B/OO+4PpxLKP0IzoZnQbBk+yUKNyvBJJdSoDJ9kQjOhmdBsCTWy4ZNKqFEZPqmEGpnQTGgmNFs4CDWy4ZN3hBoVoZnQTGj2BxvbMvuaMCXUAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkq+dvCZBm9Bz6DvB6DxYhBPkdSvwnOBuAJaOWAGb0HPoO\n' + + '8HoPAAD5ywf/cvaGM0DzcB22Q2FMzUZG4/ZmkN4OknvSj0d4hB/sPUIb9176\n' + + 'z+niFMjWZNFpIj8s36f16oMEZZ+Eleu9t6sECBxRDvO8pEwyByCXSmz8e/SH\n' + + 'Y659cvg5/A3bSe0FqR0VTI1o+Uz2BpnXG/P38C6D46btaIaJcr4cIh88wQ9J\n' + + 'lr05hOE7w/7Uo5OwyXala0NfB+8S4LIfpC2OlPOhyHQEJd2+WoFKb/6dO28D\n' + + 'TLuvgYJXJfc4R3ElcgFfm1N9ylG0Pt1F3c0C/k9bNokR2PVXgX2XSTQsx1rD\n' + + 'MCY/ePr93INyNZuTPcPlK87X6OTa2/gEW161vup2Xn2Did9HtL76Qw==\n' + + '=EkOP\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'intellectual_green_bat', + isPublic: true, + spaceDescription: 'sad_purple_pinniped', + spaceCreator: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', + spaceId: 'spaces:9dab226c7920fe06154d76f78dfe1187bdc4fda712cdd9a8b37cc6a99741a63b', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'PENDING' +} ``` ---- +</details> -### **Methods** +--- -#### **constructor** +### **To start a space** ```typescript -constructor({ - signer, - chainId, - pgpPrivateKey, - env, - setData, - }: { - signer: SignerType; - chainId: number; - pgpPrivateKey: string; - env?: ENV; - setData: (fn: (data: VideoCallData) => VideoCallData) => void; - }) {} +const response = await PushAPI.space.start({ + spaceId: + 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', + env: 'staging', +}); ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| signer_ | SignerType | - | signer object for a user | -| chainId* | number | - | chainId for the video call - Eth Mainnet: 1, Polygon Mainnet: 137 | -| pgpPrivatekey* | string | - | PGP private key of the user, used while sending video call notifications | +| spaceId_ | string | - | space id | | env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -| setData\* | `(fn: (data: VideoCallData) => VideoCallData) => void` | - | Function to update video call data | ---- +<details> + <summary><b>Expected response (start space by space id)</b></summary> -#### **create** +```typescript +// PushAPI_space_start | Response - 200 OK +{ + members: [ + { + wallet: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSr528BCADI8kQcWkaw9PKmSrwCtPBDWj+wzPhmok9jAzxzb2+qAjSV\n' + + 'rYdIrnx6PAp1rMU6qoVg4cdDbCYPV+kCj8l3lUzH/a/SfPsDWpspA/ICWMeS\n' + + 'dMdGYxHLk2gsu0wRz69qoddXMY1h5eMZEyRnr2fsX/cy15mxO2IEHYnC2/rp\n' + + '06iFpx1T8k5HWgFDpyleWyMSQ7Bnn7GutrlHYEVtIGVfXDSkea8IDLLkzBEV\n' + + '3jlBUFhpsrlcvDwDYcMYOrqSBEtg1a+GMK+2Ye/hF37KUYTAPleKXeN0cYIs\n' + + 'Va8oleZK960XYfuy5SYCJav2kaAggNWQBie5G9C4H3h7FuFwWk8LH3DhABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKvnbwQLCQcICZBm9Bz6DvB6DwMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAAAkiQgAukm3owebckwr\n' + + 'xAR42r/+CBx1uoqM2ZeEAUeYtBF7sdLEsdxFrxl8wHKAbglZwtgWcfG95v2R\n' + + 'zLcBco3v9p0IuS6DZduIfhngZ49gpYwqFGyiCOvo+k14tuMbrbOZTTKp0uc6\n' + + 'icpTyP8/1U0nZrQmmSXyfh6Hgmx1OnW3zTM7oUN1ZVvj3V6rOl+ktUPjAaYo\n' + + 'CWJjth92xhDWEPZnC/4Gz2eRoTVtmx8u+/2vNPffQVgzzHznUxB+G5XeZmPk\n' + + 'z8oxxSxII8PNiAs5LizqPjyq2gEv25GlCsMXTYz60n/t/4G7Yc94yu8xD8u3\n' + + 'BpWluHC2eW0pYFcDfiNLfv0uJCrUcM7ATQRkq+dvAQgA7v7Zz4CZdPsd4jvB\n' + + 'uDwjop/Gvoz+rbvAdS3Xrsi+OTyrWAqidnXChhwExlUNelZ9v52lGxe1twwr\n' + + 'vxeQ4M0pv4oqSlZxhkqBCyj+E7ECR2WXG7ccLlzYOz3b5BXT+fEkmVsbVTjA\n' + + 'Kttjosm7FtY4igY2Hu4UlZZW8M1tYL1R/UegFeMYGY7aO7dcKeiP0NsDwm3c\n' + + '0SiU6/JlOXAIi/ZSKDJ4b5BPK6GFj5pNWr92/V7LejlZfoHAVDbb91tiPGdP\n' + + 'y3+r9T3IYsgUDLgOpPQn6o82Nctm6CnIZqAN12nJ1DEJP2JyLDedg9b5H+aa\n' + + 'FDZFc7yQ3In/QPtjHImydLt9NwARAQABwsB2BBgBCAAqBYJkq+dvCZBm9Bz6\n' + + 'DvB6DwKbDBYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAABRUQf+KoF4UXuseLBO\n' + + 'd0PD0+hEcnsYbaPWmPZtJPWusxPl6kt421luymPiThDXwaMVzRrmxkz0dNZ3\n' + + 'bUFYtS24t2BhlXZ6cGFNRjXrA9OV0kLg/kNm1vboQ1GL8qRV9CIjPVEpksQp\n' + + 'tOiYN+X+/2XdPJkaQpITHIFV067qWQSAKIonvOI8OJYOovGRQTInz0VE71Yn\n' + + 'SeiOilKBK+p2RN38jGr0PGWt740KJ6560FzfUwTAQzz9vrkYa+vEhWe+bzOd\n' + + 'YBpxj/BRTGR19DrKlGcFPdTYz5ADxCjBuCxXgoRCbBiWwh+iIstk5qkT8uHK\n' + + 'NQjzDvo3RO1cROQp0zsikladmzGZHQ==\n' + + '=q/e/\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA10lEQVR4AcXBsWnFMBSG0c8/brOD9kgfogHUGQIuAppInSsVAQ2gdbSD64fTXl4hMI/HPWf5fXxf3DDaxkxIlTuEM+FMOFt5MtqG1XvBipGpsp9YMWaskCqWcCacCWfL4+fzwogx8069FyzhTDgTzpavv3oxEVLlFaNtzAhnwplwtvIkpIpV9hMrxsxM7wUrHxVrtA1LOBPOhLM1pIo12oaVj4rV98JMPj6wRtuwQqpYwplwJpyt3BRjZiZQuUM4E86Es7XsJ1aMTIVUeUXZTyzhTDgTzv4BnGY033BWusUAAAAASUVORK5CYII=' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0xaC6C69c657cF6022fa787B14BDdaA22936B56D65', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA2UlEQVR4AcXBQWoEIRBA0Z+ikOwNDHirbARPKDiLvkzOIATaC4iQbGt6ITSzqPc+np8/fxhpVazzcfCOr99vrK4FS3AmOBOcKRddCy9GwQoxszNHw+rKluBMcCY407QqO10L1hyNO9Kq7AjOBGeCMz0fB9YcjZ20KjtdC1bXghVixhKcCc4EZzpH446uhXfM0bAEZ4IzwZmGmLHmaOyEmNmZo7ETYsYSnAnOBGfKRVoVq2vBmqNxR1oV6+SV4ExwJjhTLroWdkLM7MzRsLoWrMCBJTgTnAnO/gGd1jrTKk/8EAAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xEf532414907E8c631307c0d501cDe6D1694bAF5e', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBobHDMBBF0ZsdjftIDeGuIkzIaGsQC1MNQkZirsLcnaQCk3yqBOzMH4N3zu11f38I+GPiinacRAwxQ8wQS/zo1flSGqNenUgujVGvziiXxsgQM8QMscSPXBqjXp1RLo1Ir84ol0bEEDPEDLHkj4lI51uvzn/4YyJiiBlihlhqx0lkZ2U0Pxci+7YyasdJxBAzxAyx1KsT8W3lil6diCFmiBlit9f9/SHQq3NFLo2IIWaIGWKpVyeybyuj+bkQ2beV0VwXIoaYIWaI/QH8GTSs76EUEQAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x2F5f27B523C8888eA79b7FA80a9CbA6b6980784c', + publicKey: null, + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW3DQAxA0W9CExjIDhogfboDCw9gICvcHmldcIAMoYLgJJ5CKzgto4KA4ILvXT5+Pl8kwydZqJHt60bl+ryRDZ9koUYmNBOaCc0u31+/L04INSrDJ2cIzYRmQrMl1Dhj+KQSapwhNBOaCc0WDvZ1o+ROZV83KtfnjUxoJjQTmi0c3B/OO+4PpxLKP0IzoZnQbBk+yUKNyvBJJdSoDJ9kQjOhmdBsCTWy4ZNKqFEZPqmEGpnQTGgmNFs4CDWy4ZN3hBoVoZnQTGj2BxvbMvuaMCXUAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkq+dvCZBm9Bz6DvB6DxYhBPkdSvwnOBuAJaOWAGb0HPoO\n' + + '8HoPAAD5ywf/cvaGM0DzcB22Q2FMzUZG4/ZmkN4OknvSj0d4hB/sPUIb9176\n' + + 'z+niFMjWZNFpIj8s36f16oMEZZ+Eleu9t6sECBxRDvO8pEwyByCXSmz8e/SH\n' + + 'Y659cvg5/A3bSe0FqR0VTI1o+Uz2BpnXG/P38C6D46btaIaJcr4cIh88wQ9J\n' + + 'lr05hOE7w/7Uo5OwyXala0NfB+8S4LIfpC2OlPOhyHQEJd2+WoFKb/6dO28D\n' + + 'TLuvgYJXJfc4R3ElcgFfm1N9ylG0Pt1F3c0C/k9bNokR2PVXgX2XSTQsx1rD\n' + + 'MCY/ePr93INyNZuTPcPlK87X6OTa2/gEW161vup2Xn2Did9HtL76Qw==\n' + + '=EkOP\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'intellectual_green_bat', + isPublic: true, + spaceDescription: 'sad_purple_pinniped', + spaceCreator: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', + spaceId: 'spaces:9dab226c7920fe06154d76f78dfe1187bdc4fda712cdd9a8b37cc6a99741a63b', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'ACTIVE' +} +``` -- This method is used to create a local stream -- Assigns the local stream obtained from the `navigator.mediaDevices.getUserMedia` to `data.local.stream` state. +</details> -```typescript -export type VideoCreateInputOptions = { - video?: boolean; - audio?: boolean; -}; +--- -async create(options: VideoCreateInputOptions): Promise<void> {} +### **To stop a space** + +```typescript +const response = await PushAPI.space.stop({ + spaceId: + 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', + env: 'staging', +}); ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| video | boolean | true | video status for the local stream | -| audio | boolean | true | audio status for the local stream | - -Note - If audio, video aren't enabled in create() then they wont be available during the call respectively. - ---- - -#### **request** +| spaceId_ | string | - | space id | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -- This method is used to request a push video call. -- Will be triggered on the initiator's end. +<details> + <summary><b>Expected response (stop space by space id)</b></summary> ```typescript -export type VideoRequestInputOptions = { - senderAddress: string; - recipientAddress: string; - chatId: string; - onReceiveMessage?: (message: string) => void; - retry?: boolean; -}; - -async request(options: VideoRequestInputOptions): Promise<void> {} +// PushAPI_space_stop | Response - 200 OK +{ + members: [ + { + wallet: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSr528BCADI8kQcWkaw9PKmSrwCtPBDWj+wzPhmok9jAzxzb2+qAjSV\n' + + 'rYdIrnx6PAp1rMU6qoVg4cdDbCYPV+kCj8l3lUzH/a/SfPsDWpspA/ICWMeS\n' + + 'dMdGYxHLk2gsu0wRz69qoddXMY1h5eMZEyRnr2fsX/cy15mxO2IEHYnC2/rp\n' + + '06iFpx1T8k5HWgFDpyleWyMSQ7Bnn7GutrlHYEVtIGVfXDSkea8IDLLkzBEV\n' + + '3jlBUFhpsrlcvDwDYcMYOrqSBEtg1a+GMK+2Ye/hF37KUYTAPleKXeN0cYIs\n' + + 'Va8oleZK960XYfuy5SYCJav2kaAggNWQBie5G9C4H3h7FuFwWk8LH3DhABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKvnbwQLCQcICZBm9Bz6DvB6DwMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAAAkiQgAukm3owebckwr\n' + + 'xAR42r/+CBx1uoqM2ZeEAUeYtBF7sdLEsdxFrxl8wHKAbglZwtgWcfG95v2R\n' + + 'zLcBco3v9p0IuS6DZduIfhngZ49gpYwqFGyiCOvo+k14tuMbrbOZTTKp0uc6\n' + + 'icpTyP8/1U0nZrQmmSXyfh6Hgmx1OnW3zTM7oUN1ZVvj3V6rOl+ktUPjAaYo\n' + + 'CWJjth92xhDWEPZnC/4Gz2eRoTVtmx8u+/2vNPffQVgzzHznUxB+G5XeZmPk\n' + + 'z8oxxSxII8PNiAs5LizqPjyq2gEv25GlCsMXTYz60n/t/4G7Yc94yu8xD8u3\n' + + 'BpWluHC2eW0pYFcDfiNLfv0uJCrUcM7ATQRkq+dvAQgA7v7Zz4CZdPsd4jvB\n' + + 'uDwjop/Gvoz+rbvAdS3Xrsi+OTyrWAqidnXChhwExlUNelZ9v52lGxe1twwr\n' + + 'vxeQ4M0pv4oqSlZxhkqBCyj+E7ECR2WXG7ccLlzYOz3b5BXT+fEkmVsbVTjA\n' + + 'Kttjosm7FtY4igY2Hu4UlZZW8M1tYL1R/UegFeMYGY7aO7dcKeiP0NsDwm3c\n' + + '0SiU6/JlOXAIi/ZSKDJ4b5BPK6GFj5pNWr92/V7LejlZfoHAVDbb91tiPGdP\n' + + 'y3+r9T3IYsgUDLgOpPQn6o82Nctm6CnIZqAN12nJ1DEJP2JyLDedg9b5H+aa\n' + + 'FDZFc7yQ3In/QPtjHImydLt9NwARAQABwsB2BBgBCAAqBYJkq+dvCZBm9Bz6\n' + + 'DvB6DwKbDBYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAABRUQf+KoF4UXuseLBO\n' + + 'd0PD0+hEcnsYbaPWmPZtJPWusxPl6kt421luymPiThDXwaMVzRrmxkz0dNZ3\n' + + 'bUFYtS24t2BhlXZ6cGFNRjXrA9OV0kLg/kNm1vboQ1GL8qRV9CIjPVEpksQp\n' + + 'tOiYN+X+/2XdPJkaQpITHIFV067qWQSAKIonvOI8OJYOovGRQTInz0VE71Yn\n' + + 'SeiOilKBK+p2RN38jGr0PGWt740KJ6560FzfUwTAQzz9vrkYa+vEhWe+bzOd\n' + + 'YBpxj/BRTGR19DrKlGcFPdTYz5ADxCjBuCxXgoRCbBiWwh+iIstk5qkT8uHK\n' + + 'NQjzDvo3RO1cROQp0zsikladmzGZHQ==\n' + + '=q/e/\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA10lEQVR4AcXBsWnFMBSG0c8/brOD9kgfogHUGQIuAppInSsVAQ2gdbSD64fTXl4hMI/HPWf5fXxf3DDaxkxIlTuEM+FMOFt5MtqG1XvBipGpsp9YMWaskCqWcCacCWfL4+fzwogx8069FyzhTDgTzpavv3oxEVLlFaNtzAhnwplwtvIkpIpV9hMrxsxM7wUrHxVrtA1LOBPOhLM1pIo12oaVj4rV98JMPj6wRtuwQqpYwplwJpyt3BRjZiZQuUM4E86Es7XsJ1aMTIVUeUXZTyzhTDgTzv4BnGY033BWusUAAAAASUVORK5CYII=' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0xaC6C69c657cF6022fa787B14BDdaA22936B56D65', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA2UlEQVR4AcXBQWoEIRBA0Z+ikOwNDHirbARPKDiLvkzOIATaC4iQbGt6ITSzqPc+np8/fxhpVazzcfCOr99vrK4FS3AmOBOcKRddCy9GwQoxszNHw+rKluBMcCY407QqO10L1hyNO9Kq7AjOBGeCMz0fB9YcjZ20KjtdC1bXghVixhKcCc4EZzpH446uhXfM0bAEZ4IzwZmGmLHmaOyEmNmZo7ETYsYSnAnOBGfKRVoVq2vBmqNxR1oV6+SV4ExwJjhTLroWdkLM7MzRsLoWrMCBJTgTnAnO/gGd1jrTKk/8EAAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xEf532414907E8c631307c0d501cDe6D1694bAF5e', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBobHDMBBF0ZsdjftIDeGuIkzIaGsQC1MNQkZirsLcnaQCk3yqBOzMH4N3zu11f38I+GPiinacRAwxQ8wQS/zo1flSGqNenUgujVGvziiXxsgQM8QMscSPXBqjXp1RLo1Ir84ol0bEEDPEDLHkj4lI51uvzn/4YyJiiBlihlhqx0lkZ2U0Pxci+7YyasdJxBAzxAyx1KsT8W3lil6diCFmiBlit9f9/SHQq3NFLo2IIWaIGWKpVyeybyuj+bkQ2beV0VwXIoaYIWaI/QH8GTSs76EUEQAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x2F5f27B523C8888eA79b7FA80a9CbA6b6980784c', + publicKey: null, + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW3DQAxA0W9CExjIDhogfboDCw9gICvcHmldcIAMoYLgJJ5CKzgto4KA4ILvXT5+Pl8kwydZqJHt60bl+ryRDZ9koUYmNBOaCc0u31+/L04INSrDJ2cIzYRmQrMl1Dhj+KQSapwhNBOaCc0WDvZ1o+ROZV83KtfnjUxoJjQTmi0c3B/OO+4PpxLKP0IzoZnQbBk+yUKNyvBJJdSoDJ9kQjOhmdBsCTWy4ZNKqFEZPqmEGpnQTGgmNFs4CDWy4ZN3hBoVoZnQTGj2BxvbMvuaMCXUAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkq+dvCZBm9Bz6DvB6DxYhBPkdSvwnOBuAJaOWAGb0HPoO\n' + + '8HoPAAD5ywf/cvaGM0DzcB22Q2FMzUZG4/ZmkN4OknvSj0d4hB/sPUIb9176\n' + + 'z+niFMjWZNFpIj8s36f16oMEZZ+Eleu9t6sECBxRDvO8pEwyByCXSmz8e/SH\n' + + 'Y659cvg5/A3bSe0FqR0VTI1o+Uz2BpnXG/P38C6D46btaIaJcr4cIh88wQ9J\n' + + 'lr05hOE7w/7Uo5OwyXala0NfB+8S4LIfpC2OlPOhyHQEJd2+WoFKb/6dO28D\n' + + 'TLuvgYJXJfc4R3ElcgFfm1N9ylG0Pt1F3c0C/k9bNokR2PVXgX2XSTQsx1rD\n' + + 'MCY/ePr93INyNZuTPcPlK87X6OTa2/gEW161vup2Xn2Did9HtL76Qw==\n' + + '=EkOP\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'intellectual_green_bat', + isPublic: true, + spaceDescription: 'sad_purple_pinniped', + spaceCreator: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', + spaceId: 'spaces:9dab226c7920fe06154d76f78dfe1187bdc4fda712cdd9a8b37cc6a99741a63b', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'ENDED' +} ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| senderAddress_ | string | - | Local peer address | -| recipientAddress* | string | - | Incoming/remote peer address | -| chatId* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | -| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | -| retry | boolean | false | If we are retrying the call, only for internal use | +</details> --- -#### **acceptRequest** - -- This method is used to accept a push video call. -- Will be triggered on the receiver's end. +### **To approve a space request** ```typescript -export type VideoAcceptRequestInputOptions = { - signalData: any; - senderAddress: string; - recipientAddress: string; - chatId: string; - onReceiveMessage?: (message: string) => void; - retry?: boolean; -}; - -async acceptRequest(options: VideoAcceptRequestInputOptions): Promise<void> {} +const response = await PushAPI.space.approve({ + status: 'Approved', + account: '0x18C0Ab0809589c423Ac9eb42897258757b6b3d3d', + senderAddress: '0x873a538254f8162377296326BB3eDDbA7d00F8E9', // spaceId + env: 'staging', +}); ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| signalData_ | any | - | Signal data received from the initiator peer via psuh notification upon call request | -| senderAddress* | string | - | Local peer address | -| recipientAddress* | string | - | Incoming/remote peer address | -| chatId\* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation | -| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel | -| retry | boolean | false | If we are retrying the call, only for internal use | +| status | 'Approved' | 'Approved' | flag for approving and rejecting space request, supports only approving for now| +| senderAddress_ | string | - | space request sender's address or spaceId of a space | +| signer\* | - | - | signer object | +| pgpPrivateKey | string | null | mandatory for users having pgp keys| +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| ---- +<details> + <summary><b>Expected response (approve space request for a spaceId)</b></summary> -#### **connect** +```typescript +// PushAPI_space_approve | Response - 204 OK +``` -- This is the final method which is used to connect a push video call. -- Will be triggered on the initiator's end. +</details> -```typescript -export type VideoConnectInputOptions = { - signalData: any; - peerAddress?: string; -}; +--- -connect(options: VideoConnectInputOptions): void {} +### **To add listeners to space** + +```typescript +const response = await PushAPI.space.addListeners({ + spaceId, + listeners: [ + `eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F`, + `eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45`, + ], + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, +}); ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| signalData_ | any | - | Signal data received from the receiver peer via push notification upon call acceptRequest | -| peerAddress | string | data.incoming[0].address | Address of the receiver peer, received via push notification upon call acceptRequest | +| spaceId_ | string | - | space id | +| listeners | Array | - | new listeners that needs to be added to the space. Don't add listeners which are already part of space | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| ---- +<details> + <summary><b>Expected response (add Listeners to space)</b></summary> -#### **disconnect** +```typescript +// PushAPI_space_add_listeners | Response - 200 OK +{ + members: [{ + wallet: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSs51IBCAC+y8oXbU2YvfI7Z4xnSRfcPecRR+nO/XVLDbt30mbn1NU8\n' + + 'wHSXcuHLJTuU9yJy1t9AMB2SY8n/YWMFbeNICF0OQVINkvFS+8Ec/F42IIlb\n' + + 'StUY8rLS9pxTQoI3k1LnQKNL1krGiEuDl2ZT3l304aPGkF1sowu5w6xnzl/o\n' + + 'nb6cgc48jVqIgqoVUCnEoxc3GKdSORm35nl0RBDasFdFPJctnpg2n7hLofU1\n' + + 'RGOIzf/cITY7AE3nta0cqaFgNsO4rO0fXRwgDBAu66CtBG4Px2X8hT7IYMum\n' + + 'XJtCis3KvrmQAOhWrbAwmWjHbkSDSYigd39rmlht21GKf0/kfoILBgRfABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKznUgQLCQcICZDTsTetOyJa2gMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBHGBWhlF6JChmgQO7tOxN607IlraAADq/Af/XWeAagX5+JCX\n' + + 'ChzadMaUtI6m2F7nT8sJcJep/a0Ldyz6kPmP9k6kmWO+QXJwl4FrP3e7HPer\n' + + 'SjTeIWm0FJ2a+pRtF+lWk7xjIWJuZxbx79nOk98arde75fT+bebne1V0raUM\n' + + 'gXPQIc60++okAPif6vJVLAaSMNbCkv8+Lsy0mJqsjY3b9iMVKWHKb8XVvTuN\n' + + 'pobxVV4dLq53lrdNDIiwAWTlbxyuKLSEF4f+hIPJX3PAhquORinOubclUwTM\n' + + '+kEmE6VI3pW4VL1VRi10cDI6ruEVwqOwQyYcp9gSDKXFR6ZXz7t0hjUUhl+3\n' + + 'z6T7yqAjExW1O4tETVSbt3jg6DjaAM7ATQRkrOdSAQgArRRrLZees3xCYyBO\n' + + '9WDzy7XCM2FxmaIJs/ibWwTtD1ZVoc9NKeOx07FYwGiYjigY6FxxJHdr20IQ\n' + + '3xieIyBLZM2XAIXrsxq4M9GLG8R6nhd35BenjcvSGiZH1Rq0aXtFt9Fd7gc6\n' + + 'E8XpMcHPH8KEnf66sPz18vrVCdstVU4Qj2ZjH25ilfeGdMj2HHfDxVN8sRhl\n' + + 'AXAcwblQ+IVXGjuKw19T4zN874bcAaOmXfzxu3+2PtxVSR5uV03x1ln3ji+b\n' + + '+GF8atJMMHCqE0FC/dEciS+BWSQtv0D93XWjzExJeyhd7Z+I3BG8JPuJT5Yj\n' + + '4PxktEgwUxQc83JFFwED9knzyQARAQABwsB2BBgBCAAqBYJkrOdSCZDTsTet\n' + + 'OyJa2gKbDBYhBHGBWhlF6JChmgQO7tOxN607IlraAABLdggAhe1KLjtHTsUI\n' + + 'SR0K25EJ+9gXC7wmebve9wNZL22/Ud9hnyS77/VUmMNBgdPyhm/9ITMhVtTt\n' + + 'rRNo1AzsVKDn3/dW1kc+nSribOufxzMoBM7Bm918Zt/0/7wCegz0bp3EAoQ8\n' + + 'KEa2KPY9lSh2WtEDoA87D8JB1xwIfcR98vg5/AZ7VdtE88foSqXAm+6F85hz\n' + + 'nAASNBO9CCDvUofR28b4exT/aWX0qZxLAukgH7fnYC3KPVv+9ug6mdyJPsOZ\n' + + 'LFjF327UKLrBuQ6VRlfKF+XULJbtNPxckgwO1V/oxycq/M67acGoXgc2MgP/\n' + + '2qOkbiQC0ZxcA+Ze5TNNhuGWKv6d9g==\n' + + '=S9Ba\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1UlEQVR4AcXBQU1FUQxF0f2bZ6gaIOkAC4yxUCRQHyRoqIo6wcJnesLgEgJJ17p9vDzeEe9vd046nZOo4eT59YYylhnLjGW3p8+HOwedzl9EDSfGMmOZsezim05HRQ2q0zmJGlSno6IGZSwzlhnLrk5HRQ2q01FRw0mno6IG1ekoY5mxzFh2RQ2q01FRw29EDarTUVGDMpYZy4xlV6ejogbV6aio4aTTUVGD6nSUscxYZiy7+KbT+U+dzomxzFhmLLv4QdSgnl9vHNWgOp0TY5mxzFj2BfKPPQUA5ipXAAAAAElFTkSuQmCC' + }], + pendingMembers: [{ + wallet: 'eip155:0x4d2eFB18383a48aCe19a198ae5228BB4bf854cec', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9UlEQVR4AcXBoZHDMBCG0S87ZqEmooaiLmJJsNtwIyFuwzhERZgKmoqkhxz9HaCbmwP73u159w8iN0fVVFC5OT01FVRujqqpoIxgRjAj2JCbo6b1QE3LiDrpeywjF+vBRXOUEcwIZgQb+MW5zaiaCl3NUdN60GMEM4IZwYaaChfNUdN6cNGcnmk9UOc2o2oqKCOYEcwINuTmqJoKF835i3ObUTUVVG6OMoIZwYxgt+fdP4jHMqJe+xuVm9NTU0E9lhH12t8oI5gRzAg28OXcZlTeuKip0JObo06+7AVlBDOCGcFuz7t/6MjN+Y+aCj1GMCOYEewHE5pCbf3G8WQAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x8E50Bfb57f803814c242c5a25890f5F0c13304fF', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsWkDQRCG0W+Gy53pkgVVsiXYFVx2rsANiCtEmQoxbCHmYBNd6gLW6aBgjDDmf89eXr8GiW6VqIxGplslKqORccQcMUdsWued6Ho/k+lW+Yt13okcMUfMEZt4sM470YUb0XYsZC6nG9HKTsYRc8Qcsel6P5PpVnnGdixEZTQyjpgj5ohNPOhWyZTRyHSrRN0qURmNyBFzxBwx+34rg0QZjahbJVNGI+pWyThijpgjNvGLbpWojEamW+UZjpgj5ojZx/vnINiOhf90Od2IHDFHzBH7AWIQNGL6hyehAAAAAElFTkSuQmCC' + }, + { + wallet: 'eip155:0xaA6E4434D881D2bDEea891AE127313AE5515a06B', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyklEQVR4AcXBsZGDMABE0c8OqQPGZShzCdCCVNZVIhVAYrpQ6g48lMClkgMlBPve9HjtF0bCTJgJszmXykiKgTtyqYwIM2EmzOYUAyO5VO5IMTAizISZMJu/70rrOOmkGLgjl0prXegIM2EmzKbHa79o5FIZSTEwkktlJMVAS5gJM2E282Nd6Dy3QCuXykiKgdb3XRkRZsJMmE375++isS50jpNOioGRXCqtdaFznHSEmTATZjM/nluglUvljucWaOVSaQkzYSbM/gGGCDCC/3c1nwAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xf6106dd699B6e40f1E822c38DDA459F533470b11', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAwUlEQVR4AcXBsU2DMRSF0S9XHoIFIipmIEW2sPQ6pmGEdJa8BYXXsOgYxKF9afzrr+45l++39uSEUGenrcoZwkyYCbPCgVAna6uyE+pkbVV2hJkwE2Yl1MnaqmT364Ps5/eLnfv1QRZzkIU6mTATZsKscCDm4IXYijk4Q5gJM2FWONDeb7yYbLX3G1nMwY4wE2bCrHAg5iALdbYmpwgzYSbMLh+ff0+MhJkwE2Yl5iALdXbaquyEOjttVTJhJsyE2T84uix63kKmNgAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xAF3d4989652a6ED5554b6191c555525977424Cc9', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA3UlEQVR4AcXBsW3DMBCG0c8/tEMmUClkBDVaQAWHIKAZWHAGAxyChZDejbOCkcrDOO3ZxQlGENx7p4/t64Gj58JfpFbxiGAimAg2cOB6uWHNy4TnernxDhFMBBPBBl70XHg2YaVW8fRcsOalYKVWsUQwEUwEGziQWsXqueBJrWL1XPCIYCKYCHb6/vl8YKRW+U89FywRTAQTwQZebOOK53zf8Wzjim/CEsFEMBFs4MD5vmP1XPCktmNt44pHBBPBRLAhtYrVc+HZipXajmcbV6x5mbBSq1gimAgmgv0CTksv6eJNDqkAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x2ccBeEf6e30dF46D0A7Ee79Bc66FBF3beA7EeA5A', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBIW6AMBiG4XdfmnAYboLlCE3NFBLX4JB40hMsWM4x08OgNvsXUbMs//N8fH59/2DksfCfthqxhDPhTDgLvGw1Yq3nhLWnm571nLD2dNMjnAlnwlnIY8HaasQajplGpWs4ZhqVRh4LlnAmnAln4VkuGinSs54TXcdMz7NcWMKZcCachT3dWHksWM9yYQ3HTM+zXFj5oLGlG0s4E86Es8DLViONFLEyhZ493TQqXcKZcCacCWfCmXAmnAVe8lj4izwWerYasYQz4Uw4+wXktDHpzVVJlwAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F', + publicKey: null, + isSpeaker: false, + image: null + }, + { + wallet: 'eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45', + publicKey: null, + isSpeaker: false, + image: null + }, + { + wallet: 'eip155:0xa145b34443e28C8f718Cd0691Dc41A81E0d0A857', + publicKey: null, + isSpeaker: false, + image: null + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkrOdUCZDTsTetOyJa2hYhBHGBWhlF6JChmgQO7tOxN607\n' + + 'IlraAAAqUQf9FvAtNouG7+2YSyyx7eiHRJZroDPFohH/F2xyc+oJkgh40p2y\n' + + 'hyKw+DSp0FA+IiT95/y8RbGDUrNFz+/kdMfZWCEYFim3Cy+c5k1/YNc8qxx6\n' + + 'VLwef+2YZepC1pSS9K0zbu04uVPWrNmDa5lHXqzTx/mOxWlxLD0NfpI60csE\n' + + 'iQx57duy2gMeW9MwOKSFjOSnWHKy7AySm/vBwZ9Rj4gnOhsvwbAfLprQQf4G\n' + + 'cUaxG/HOb0c/8Ugews0Z1uDJFmGKjT5R5CR63vPo5qDGQwWkm+LYpshCIV+K\n' + + 'ofLepDqQRuEFa7VyUlDOvMcF15LtlvAhwhkIVHvTGjXZC91e8/IUsQ==\n' + + '=UpR2\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'weird_moccasin_alligator', + isPublic: true, + spaceDescription: 'equivalent_blue_armadillo', + spaceCreator: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', + spaceId: 'spaces:d37c4e303a2ff194e546d3af94353ec829324a578ebffbeadebd1ba91ab88548', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'PENDING' +} +``` -- This method is used to end a push video call. -- Can be triggered on the initiator as well as receivers end. +</details> -```typescript -export type VideoDisconnectOptions = { - peerAddress: string; -} | null; +--- -disconnect(options: VideoDisconnectOptions): void {} +### **To remove listeners from space** + +```typescript +const response = await PushAPI.space.removeListeners({ + spaceId, + listeners: [ + `eip155:0xB12869BD3a0F9109222D67ba71e8b109B46908f9`, + `eip155:0x2E3af36E1aC6EEEA2C0d59E43Be1926aBB9eE0BD`, + ], + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, +}); ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| peerAddress | string | data.incoming[0].address | Address of the peer to be disconnected from | - ---- - -#### **enableVideo** +| spaceId_ | string | - | space id | +| listeners | Array | - | existing listeners that needs to be removed from the space. Don't add listeners which are not part of space | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -- This method is used to enable/disable the video (from `data.local.stream`) for a push video call. -- Can be triggered on the initiator as well as receivers end. - <<<<<<< HEAD -- # **Note -** If video was not enabled during `create()` then it will always remain off. -- **Note -** If video was not enabled during `create()` then it will always remain off. - > > > > > > > main +<details> + <summary><b>Expected response (remove Listeners from space)</b></summary> ```typescript - export type EnableVideoInputOptions = { - state: boolean; +// PushAPI_space_from_speakers | Response - 200 OK +{ + members: [{ + wallet: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSs6YABCADC4ldJKGpZ0Z+JJwA1t/1JWp5+dnR98nr7RHPX8eEGxIhL\n' + + 'gtx5TZmek2BcGzNcg66+GEyC4np9USaCZ4/YC9ZMLw8BQKzhOcd3ZILyGtGV\n' + + 'BijBNwjPIbQcy5/cXVtfKCvf303BDYddPYuJ1xFAh7kpvhcR4a72CSpeyEjM\n' + + 'UndteAVTIxqwdpnXIdqpwu6HrSJ089GpHV+XeaDo4Uhg+iHJsCRJy2VJ5m61\n' + + 'CwGx55f3ror6rAXQd+hEx+keLxYINNJLLvfvE9IGsIbKRFZx+emjXQZusbJp\n' + + 'zXYhJnEeHPLVDjWhzo8Q3/4gvOz8m6a+A9sl49sqodLdxVlXQ7d4CuylABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKzpgAQLCQcICZCaDezdj8j4SwMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAACCLgf/dB412nDRcOxR\n' + + 'dNSj2AYknJ+NKeX38KuksyR6wypnaJWpapmIeZCfFjeoBjuBCPd6unvN/IlZ\n' + + 'zPwl66lO5GKJxDaDd1/infxM/dbtFQSESLXlweRLQ/v1+plsntrBUyvbY4uH\n' + + 'Mh9PImYsLY+zo8P5mpBV5AGAMA6R9qmu3axH/MnKVdB0Ky6C/jP+7lPs/QVT\n' + + 'qsISyyI1E9E6Oivzxmao1axfXLdEvICHb6uD0R4p5SUVqHJX41OwM8BFevhK\n' + + '07Hi+c7NhUWp0sxXEOs6dneJZwerCD3EahutpP1Oyt5T8MZitysn2yJ+s5ks\n' + + 'SZza+x8OmCMcMZfZnIsJNnIUvPboP87ATQRkrOmAAQgAteDgsJJ0ftPD+P15\n' + + 'rKgkLuSCD2iwQgm2k8/ZDaXJBsdm4sJYTt2y0ckx7MRpXgLuIyidOGctqVL6\n' + + '/Rl2Hfl30JQPok5cYmYLENVuFz94MEvgDOo8jacyfPdLGPMWZMLRojyM/Yvs\n' + + 'nhDZ8if3zEstP4h3HcpdT+PWSmsJWjrq57la4vKbfILtKfTBaf8sibm5UuZA\n' + + '5Y/SIPxfVC+ybCPAjo4tpDYP901V+wxXDJ8BlZ4AaVvk20MYMzuAjBna+iwD\n' + + 'f0j4CccEabd2EVtAQQcMCg2yTjOT22Dt0jfpDuohDNaXDhX2ZQlJIdlSLCEI\n' + + 'a3c7g+uU9bnNqt7LHPgMzLYKnwARAQABwsB2BBgBCAAqBYJkrOmACZCaDezd\n' + + 'j8j4SwKbDBYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAAD2vQgAu9+sd4AT5b6c\n' + + 'mWOaQBXz2XVfJXYQFNlBdOF23reycF9r7vDAKSRpeyMSyOfRAi0qdLynQ1dN\n' + + 'MXV/gfO0G9dzFu513P/Y1sZxQi0uLRKL9hMcgEQ8FLo8/PGfVcoLfQASryGj\n' + + 'Z8ybCFqiXocGpt2VkkK4wwgv+ZwZ8M1ubz0Boby6A1/kTYs/6ll+QekpB4ao\n' + + 'kJKw3DWvVNR/xODFfMQcClvzAtqwfxhTZXBMbZ4vAG5m1ExGmA15cGXrAfwV\n' + + 'nR2vOhPYDeZGbBKktM3xfDts75N2NF/TBpvazV2DTKpkLqvVitFHWvSMMpVd\n' + + 'dwk9tEOmBlj2AoYATvQ9kKHRTD27Wg==\n' + + '=IXzf\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBoXHEMBRF0Zs3oqpHNYgJecZdGKYMd5GZRWaCwaohZbiAhP5d8HeC3jkfnz/fvwSTRua+DjJ1nGQ6i0iYCTNhVnjRWUSTRlTHyX90FhlhJsyEWeHFpJG5r4NMHSfRpBF1FpEwE2bCrPDGfR1E29jJPK6DqI6TjDATZsKsTBqZOk6iSa6ORmbSiISZMBNmpbOIHtcXUR0nUWeRmTSi+zqItrETCTNhJswKL7ax82wRTRqZzuLJ2MkIM2EmzApvTBpRZ5GZNKLOIiPMhJkw+wPV2i2sD43hKwAAAABJRU5ErkJggg==' + }], + pendingMembers: [{ + wallet: 'eip155:0xC1469cB7b59d16dC887D4C11faB3E3C0abBeA12C', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsWnFMBSG0e9dBAGDPUs6LeAFNIEb1x5GtRtDei3gBQzZIFtYYEj10t73CkFw8Z/z+Pj+euJs14iXlsodJfd4U7fjGWKGmCEWzjnilUzTsB60nHOk5ZwjniFmiBligTdTt+MlIt52jbRVvKnb8RIRzxAzxAyxx+/nzxMhQ8wQM8RCyT0taancUXJPiyFmiBligTdTt+NNKy/OOdIyrAct2zXiGWKGmCEW0lJ5kUe8tFT+45wjXsk9XloqniFmiBliYVgPvHOOeCX33JGWijesB54hZogZYn8uFTTKoy9pgwAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xccF7a3131E0E73F83Bc457C27494411a57f23248', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9ElEQVR4AcXBIWoEMRSA4X8fw6qayBW9zULVEBFygLqcqMwdhlBCbKjqXSLjY7b2UZEVpbzvu3x8vT5QShhoqUa0Yz9ZSTWiHfuJ5rNDE4wJxgRjl8/v9wdKn43/dLve0QRjgjHB2NZnQ7td72h9NrQSBis+O7Tb9Y7WZ0MTjAnGBGMbv/TZ0EoYaD47VkoYaD43VgRjgjHB2MYTqUa0Yz9ZSTWi9dlYEYwJxgRjlzf38kDx2aGVMNBSjawc+4nms0MrYaAJxgRjgrGNJ1KNaH02VlKNaH02VgRjgjHB2OazQythoKXKn5Qw0Hx2aIIxwZhg7Ae2cUcV4Bl8pAAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x052aD82D3a7b4DAb5b9BcFED771D28703a6faadf', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBoXFDQQxF0RtlkZsQNjHICKYYV7DFCAW6II2BycfbhklCNR/sTNA75+Pn+/MXIUPMEDPEBifhSVdr0oUnO7UmXXjS1Zp0hpghZogZYoaYIWaIDU5qTbrwpHtfnuyEJ12tyY4hZogZYiM86WpNdl7Hg53wL3bCk84QM8QMscFJeNLVmnS3652dOiZdeLJjiBlihtioNenCky486eqY7IQnO7UmnSFmiBliIzzpak262/XOf7wvT7rX8aALTzpDzBAzxP4AMOQyARcWaToAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x956f73E5a3BF0D19299BF74bD6dc819D7f775eC7', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsYnDMBiG4dc/nsHgHeJWS1x7G6QzqNQUKlUHLn12ONdqNYTBS/ja/xqBCeF7nmFbbydODoVPSjXiGWKGmCE2Pu8vvPT45pOe9xeeIWaIGWLj0Xa8HAo9qUZ6cih0tR3PEDPEDLFhW28nTg4FL9XIO3IoeKlGPEPMEDPEhq+f3xNnWmZ6jrbTMy0zPUfb8QwxQ8wQG6dlxjvajpdq5JLKPzkUvGmZ8QwxQ8wQG4+246Ua8XIovCPViJcpeIaYIWaIDdt6O7kgh0JPqpErDDFDzBD7AzabOPmHFg/aAAAAAElFTkSuQmCC' + }, + { + wallet: 'eip155:0x19da526eD1a57E07D48aa25aDa6cbA7E41FF3129', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyUlEQVR4AcXBsY1CQQxF0cvTFEHuNn4jxB6JJggpw5Mh/UZogmByumBTi2DQahf5nMN2vr1IjvtG1ufgL8Kc7Hm6k4liopgo1i7XB1nsG990uT7IRDFRTBRrfBDmZH0OVsKc3xDFRDFRrPFBn4MszFnpc5CFOSuimCgmih228+1Fctw3vul5upOJYqKYKNaO+0bW5yALc7I+BythTtbnIAtzMlFMFBPFGm/CnP8U5qyIYqKYKNZ40+dgJcxZ6XOwEuZkopgoJor9AIckL2mEiBQrAAAAAElFTkSuQmCC' + }, + { + wallet: 'eip155:0x77059B40Ec974883b98a23eef519b4076D1Cf9F1', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsY0CMRRF0cuTQ6rYaQFiAvdBYMkFkFEAwWYTryxZ2kIcEE8N1MKmH4JJRuw7Z/d7uD0JRu1EuRW2GLUT5VaIhJkwE2a788/XEyNhJsyEWcqtEI3a+aTcCpEwE2bCLI3aia77E9EyT2xxvDyIvmsnEmbCTJgl3izzRDRqJ8qtsGbUzou58KLeiYSZMBNmKbfCf8qtEAkzYSbM0qidTxq1s0aYCTNhlq77E9EyT2yRW2HN8fIgEmbCTJj9AUPBKWCCQlIAAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkrOmCCZCaDezdj8j4SxYhBGZpOFBNtTj1Oqt695oN7N2P\n' + + 'yPhLAAD+iwf/dvaRCTwXKGH6iUe49NpyTHMaD6ZwaLerk+K4Ojehbdoo0mDf\n' + + 'aOu/MR8wfqk49h2436rcMmyeM5avcMgmtGUmIdy/6hCZ6zxR/3E5t/vq5UfO\n' + + '3YFO1VLghR5cTYqR9bMLFkvvCB4P29rnaok2QVKTBZLfyAM4wu1h2DDBESoz\n' + + 'SS+ZtQLPz6/y7gOQobO0zbwBPmy8MpVVu1wxht+sneOMvZX+5al679nQbwNL\n' + + 'oCcU3UKrlqMhuFgMTCKx99VLcc4JbhBf2M+IHf78NtQ9mcQC/X+gxRfp6f+p\n' + + '2RePQzkmUH5vqXjzcUsNBWJPOyjl09/IZWWwaeiUjsPazjxqDtYNHg==\n' + + '=H4X4\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'sheer_ivory_ox', + isPublic: true, + spaceDescription: 'specific_green_alpaca', + spaceCreator: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', + spaceId: 'spaces:bc96011f182e2c86ad68aaf4c95c4a916c808088370cb0ba294f9168e2ff6328', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'PENDING' } - -enableVideo(options: EnableVideoInputOptions): void ``` -Allowed Options (params with \* are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| state | boolean | - | true for enable and false for disable | +</details> --- -#### **enableAudio** - -- This method is used to enable/disable the audio (from `data.local.stream`) for a push video call. -- Can be triggered on the initiator as well as receivers end. - <<<<<<< HEAD -- # **Note -** If audio was not enabled during `create()` then it will always remain off. -- **Note -** If audio was not enabled during `create()` then it will always remain off. - > > > > > > > main +### **To add speakers to space** ```typescript -export type EnableAudioInputOptions = { - state: boolean; -} - -enableAudio(options: EnableAudioInputOptions): void +const response = await PushAPI.space.addSpeakers({ + spaceId, + listeners: [ + `eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F`, + `eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45`, + ], + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, +}); ``` -Allowed Options (params with \* are mandatory) +Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| state | boolean | - | true for enable and false for disable | - ---- - -#### **isInitiator** - -- This method is used to tell if the current peer is the initator of the push video call or not. -- Can be triggered on the initiator as well as receivers end. - -```typescript -isInitiator(): boolean -``` - ---- - -## For Spaces +| spaceId_ | string | - | space id | +| speakers | Array | - | new speakers that needs to be added to the space. Don't add speakers which are already part of space | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -### **To create a space** +<details> + <summary><b>Expected response (add Speakers to space)</b></summary> ```typescript -// pre-requisite API calls that should be made before -// need to get user and through that encryptedPvtKey of the user -const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); - -// need to decrypt the encryptedPvtKey to pass in the api using helper function -const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); - -// actual api -const response = await PushAPI.space.create({ - spaceName:'wasteful_indigo_warbler', - spaceDescription: 'boring_emerald_gamefowl', - listeners: ['0x9e60c47edF21fa5e5Af33347680B3971F2FfD464','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - spaceImage: <space image link> , - speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - isPublic: true, - account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', - env: 'staging', - pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key - scheduleAt: new Date("2024-07-15T14:48:00.000Z"), - scheduleEnd: new Date("2024-07-15T15:48:00.000Z") -}); +// PushAPI_space_add_speakers | Response - 200 OK +{ + members: [{ + wallet: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGSs51IBCAC+y8oXbU2YvfI7Z4xnSRfcPecRR+nO/XVLDbt30mbn1NU8\n' + + 'wHSXcuHLJTuU9yJy1t9AMB2SY8n/YWMFbeNICF0OQVINkvFS+8Ec/F42IIlb\n' + + 'StUY8rLS9pxTQoI3k1LnQKNL1krGiEuDl2ZT3l304aPGkF1sowu5w6xnzl/o\n' + + 'nb6cgc48jVqIgqoVUCnEoxc3GKdSORm35nl0RBDasFdFPJctnpg2n7hLofU1\n' + + 'RGOIzf/cITY7AE3nta0cqaFgNsO4rO0fXRwgDBAu66CtBG4Px2X8hT7IYMum\n' + + 'XJtCis3KvrmQAOhWrbAwmWjHbkSDSYigd39rmlht21GKf0/kfoILBgRfABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKznUgQLCQcICZDTsTetOyJa2gMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBHGBWhlF6JChmgQO7tOxN607IlraAADq/Af/XWeAagX5+JCX\n' + + 'ChzadMaUtI6m2F7nT8sJcJep/a0Ldyz6kPmP9k6kmWO+QXJwl4FrP3e7HPer\n' + + 'SjTeIWm0FJ2a+pRtF+lWk7xjIWJuZxbx79nOk98arde75fT+bebne1V0raUM\n' + + 'gXPQIc60++okAPif6vJVLAaSMNbCkv8+Lsy0mJqsjY3b9iMVKWHKb8XVvTuN\n' + + 'pobxVV4dLq53lrdNDIiwAWTlbxyuKLSEF4f+hIPJX3PAhquORinOubclUwTM\n' + + '+kEmE6VI3pW4VL1VRi10cDI6ruEVwqOwQyYcp9gSDKXFR6ZXz7t0hjUUhl+3\n' + + 'z6T7yqAjExW1O4tETVSbt3jg6DjaAM7ATQRkrOdSAQgArRRrLZees3xCYyBO\n' + + '9WDzy7XCM2FxmaIJs/ibWwTtD1ZVoc9NKeOx07FYwGiYjigY6FxxJHdr20IQ\n' + + '3xieIyBLZM2XAIXrsxq4M9GLG8R6nhd35BenjcvSGiZH1Rq0aXtFt9Fd7gc6\n' + + 'E8XpMcHPH8KEnf66sPz18vrVCdstVU4Qj2ZjH25ilfeGdMj2HHfDxVN8sRhl\n' + + 'AXAcwblQ+IVXGjuKw19T4zN874bcAaOmXfzxu3+2PtxVSR5uV03x1ln3ji+b\n' + + '+GF8atJMMHCqE0FC/dEciS+BWSQtv0D93XWjzExJeyhd7Z+I3BG8JPuJT5Yj\n' + + '4PxktEgwUxQc83JFFwED9knzyQARAQABwsB2BBgBCAAqBYJkrOdSCZDTsTet\n' + + 'OyJa2gKbDBYhBHGBWhlF6JChmgQO7tOxN607IlraAABLdggAhe1KLjtHTsUI\n' + + 'SR0K25EJ+9gXC7wmebve9wNZL22/Ud9hnyS77/VUmMNBgdPyhm/9ITMhVtTt\n' + + 'rRNo1AzsVKDn3/dW1kc+nSribOufxzMoBM7Bm918Zt/0/7wCegz0bp3EAoQ8\n' + + 'KEa2KPY9lSh2WtEDoA87D8JB1xwIfcR98vg5/AZ7VdtE88foSqXAm+6F85hz\n' + + 'nAASNBO9CCDvUofR28b4exT/aWX0qZxLAukgH7fnYC3KPVv+9ug6mdyJPsOZ\n' + + 'LFjF327UKLrBuQ6VRlfKF+XULJbtNPxckgwO1V/oxycq/M67acGoXgc2MgP/\n' + + '2qOkbiQC0ZxcA+Ze5TNNhuGWKv6d9g==\n' + + '=S9Ba\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isSpeaker: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1UlEQVR4AcXBQU1FUQxF0f2bZ6gaIOkAC4yxUCRQHyRoqIo6wcJnesLgEgJJ17p9vDzeEe9vd046nZOo4eT59YYylhnLjGW3p8+HOwedzl9EDSfGMmOZsezim05HRQ2q0zmJGlSno6IGZSwzlhnLrk5HRQ2q01FRw0mno6IG1ekoY5mxzFh2RQ2q01FRw29EDarTUVGDMpYZy4xlV6ejogbV6aio4aTTUVGD6nSUscxYZiy7+KbT+U+dzomxzFhmLLv4QdSgnl9vHNWgOp0TY5mxzFj2BfKPPQUA5ipXAAAAAElFTkSuQmCC' + }], + pendingMembers: [{ + wallet: 'eip155:0x4d2eFB18383a48aCe19a198ae5228BB4bf854cec', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9UlEQVR4AcXBoZHDMBCG0S87ZqEmooaiLmJJsNtwIyFuwzhERZgKmoqkhxz9HaCbmwP73u159w8iN0fVVFC5OT01FVRujqqpoIxgRjAj2JCbo6b1QE3LiDrpeywjF+vBRXOUEcwIZgQb+MW5zaiaCl3NUdN60GMEM4IZwYaaChfNUdN6cNGcnmk9UOc2o2oqKCOYEcwINuTmqJoKF835i3ObUTUVVG6OMoIZwYxgt+fdP4jHMqJe+xuVm9NTU0E9lhH12t8oI5gRzAg28OXcZlTeuKip0JObo06+7AVlBDOCGcFuz7t/6MjN+Y+aCj1GMCOYEewHE5pCbf3G8WQAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x8E50Bfb57f803814c242c5a25890f5F0c13304fF', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsWkDQRCG0W+Gy53pkgVVsiXYFVx2rsANiCtEmQoxbCHmYBNd6gLW6aBgjDDmf89eXr8GiW6VqIxGplslKqORccQcMUdsWued6Ho/k+lW+Yt13okcMUfMEZt4sM470YUb0XYsZC6nG9HKTsYRc8Qcsel6P5PpVnnGdixEZTQyjpgj5ohNPOhWyZTRyHSrRN0qURmNyBFzxBwx+34rg0QZjahbJVNGI+pWyThijpgjNvGLbpWojEamW+UZjpgj5ojZx/vnINiOhf90Od2IHDFHzBH7AWIQNGL6hyehAAAAAElFTkSuQmCC' + }, + { + wallet: 'eip155:0xaA6E4434D881D2bDEea891AE127313AE5515a06B', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyklEQVR4AcXBsZGDMABE0c8OqQPGZShzCdCCVNZVIhVAYrpQ6g48lMClkgMlBPve9HjtF0bCTJgJszmXykiKgTtyqYwIM2EmzOYUAyO5VO5IMTAizISZMJu/70rrOOmkGLgjl0prXegIM2EmzKbHa79o5FIZSTEwkktlJMVAS5gJM2E282Nd6Dy3QCuXykiKgdb3XRkRZsJMmE375++isS50jpNOioGRXCqtdaFznHSEmTATZjM/nluglUvljucWaOVSaQkzYSbM/gGGCDCC/3c1nwAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xf6106dd699B6e40f1E822c38DDA459F533470b11', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAwUlEQVR4AcXBsU2DMRSF0S9XHoIFIipmIEW2sPQ6pmGEdJa8BYXXsOgYxKF9afzrr+45l++39uSEUGenrcoZwkyYCbPCgVAna6uyE+pkbVV2hJkwE2Yl1MnaqmT364Ps5/eLnfv1QRZzkIU6mTATZsKscCDm4IXYijk4Q5gJM2FWONDeb7yYbLX3G1nMwY4wE2bCrHAg5iALdbYmpwgzYSbMLh+ff0+MhJkwE2Yl5iALdXbaquyEOjttVTJhJsyE2T84uix63kKmNgAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0xAF3d4989652a6ED5554b6191c555525977424Cc9', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA3UlEQVR4AcXBsW3DMBCG0c8/tEMmUClkBDVaQAWHIKAZWHAGAxyChZDejbOCkcrDOO3ZxQlGENx7p4/t64Gj58JfpFbxiGAimAg2cOB6uWHNy4TnernxDhFMBBPBBl70XHg2YaVW8fRcsOalYKVWsUQwEUwEGziQWsXqueBJrWL1XPCIYCKYCHb6/vl8YKRW+U89FywRTAQTwQZebOOK53zf8Wzjim/CEsFEMBFs4MD5vmP1XPCktmNt44pHBBPBRLAhtYrVc+HZipXajmcbV6x5mbBSq1gimAgmgv0CTksv6eJNDqkAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x2ccBeEf6e30dF46D0A7Ee79Bc66FBF3beA7EeA5A', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBIW6AMBiG4XdfmnAYboLlCE3NFBLX4JB40hMsWM4x08OgNvsXUbMs//N8fH59/2DksfCfthqxhDPhTDgLvGw1Yq3nhLWnm571nLD2dNMjnAlnwlnIY8HaasQajplGpWs4ZhqVRh4LlnAmnAln4VkuGinSs54TXcdMz7NcWMKZcCachT3dWHksWM9yYQ3HTM+zXFj5oLGlG0s4E86Es8DLViONFLEyhZ493TQqXcKZcCacCWfCmXAmnAVe8lj4izwWerYasYQz4Uw4+wXktDHpzVVJlwAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F', + publicKey: null, + isSpeaker: true, + image: null + }, + { + wallet: 'eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45', + publicKey: null, + isSpeaker: true, + image: null + }, + { + wallet: 'eip155:0xa145b34443e28C8f718Cd0691Dc41A81E0d0A857', + publicKey: null, + isSpeaker: false, + image: null + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkrOdUCZDTsTetOyJa2hYhBHGBWhlF6JChmgQO7tOxN607\n' + + 'IlraAAAqUQf9FvAtNouG7+2YSyyx7eiHRJZroDPFohH/F2xyc+oJkgh40p2y\n' + + 'hyKw+DSp0FA+IiT95/y8RbGDUrNFz+/kdMfZWCEYFim3Cy+c5k1/YNc8qxx6\n' + + 'VLwef+2YZepC1pSS9K0zbu04uVPWrNmDa5lHXqzTx/mOxWlxLD0NfpI60csE\n' + + 'iQx57duy2gMeW9MwOKSFjOSnWHKy7AySm/vBwZ9Rj4gnOhsvwbAfLprQQf4G\n' + + 'cUaxG/HOb0c/8Ugews0Z1uDJFmGKjT5R5CR63vPo5qDGQwWkm+LYpshCIV+K\n' + + 'ofLepDqQRuEFa7VyUlDOvMcF15LtlvAhwhkIVHvTGjXZC91e8/IUsQ==\n' + + '=UpR2\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', + spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'weird_moccasin_alligator', + isPublic: true, + spaceDescription: 'equivalent_blue_armadillo', + spaceCreator: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', + spaceId: 'spaces:d37c4e303a2ff194e546d3af94353ec829324a578ebffbeadebd1ba91ab88548', + scheduleAt: '2023-07-15T14:48:00.000Z', + scheduleEnd: '2023-07-15T15:48:00.000Z', + status: 'PENDING' +} ``` -### **To create a token gated space** +</details> -```typescript -// pre-requisite API calls that should be made before -// need to get user and through that encryptedPvtKey of the user -const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); +--- -// need to decrypt the encryptedPvtKey to pass in the api using helper function -const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); +### **To remove speakers from space** -// actual api -const response = await PushAPI.space.create({ - spaceName:'wasteful_indigo_warbler', - spaceDescription: 'boring_emerald_gamefowl', - listeners: ['0x9e60c47edF21fa5e5Af33347680B3971F2FfD464','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - spaceImage: <space image link> , - speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - rules: { - 'spaceAccess': { - 'conditions': [ - { - 'any': [ - { - 'type': 'PUSH', - 'category': 'ERC20', - 'subcategory': 'holder', - 'data': { - 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', - 'amount': 1000, - 'decimals': 18 - } - }, - { - 'type': 'GUILD', - 'category': 'guildRoles', - 'subcategory': 'specificRole', - 'data': { - 'guildId': '13468', - 'guildRoleId': '19924' - } - } - ] - } - ] - } - }, - isPublic: true, - account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', - env: 'staging', - pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key - scheduleAt: new Date("2024-07-15T14:48:00.000Z"), - scheduleEnd: new Date("2024-07-15T15:48:00.000Z") +```typescript +const response = await PushAPI.space.removeSpeakers({ + spaceId, + speakers: [ + `eip155:0xB12869BD3a0F9109222D67ba71e8b109B46908f9`, + `eip155:0x2E3af36E1aC6EEEA2C0d59E43Be1926aBB9eE0BD`, + ], + signer: signer, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, }); ``` Allowed Options (params with _ are mandatory) | Param | Type | Default | Remarks | |----------|---------|---------|--------------------------------------------| -| account_ | string | - | user address | -| spaceName* | string | - | group name | -| spaceDescription* | string | - | group description | -| spaceImage* | string | - | group image link | -| listeners* | Array<string> | - | wallet addresses of all listeners except speakers and spaceCreator | -| speakers* | Array<string> | - | wallet addresses of all speakers except listeners and spaceCreator | -| isPublic* | boolean | - | true for public space, false for private space | -| scheduleAt\* | Date | - | Date time when the space is scheduled to start | -| scheduleEnd | Date | - | Date time when the space is scheduled to end | -| contractAddressERC20 (deprecated) | string | null | ERC20 Contract Address | -| numberOfERC20 (deprecated) | int | 0 | Minimum number of tokens required to join the group | -| contractAddressNFT (deprecated) | string | null | NFT Contract Address | -| numberOfNFTTokens (deprecated) | int | 0 | Minimum number of nfts required to join the group | -| rules | Rules | - | conditions for space access (see format below) | -| pgpPrivateKey | string | null | mandatory for users having pgp keys| +| spaceId_ | string | - | space id | +| speakers | Array | - | existing speakers that needs to be removed from the space. Don't add speakers which are not part of space | | env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -## **Rules format** - -```typescript -export enum ConditionType { - PUSH = 'PUSH', - GUILD = 'GUILD', -} - -export type Data = { - contract?: string; - amount?: number; - decimals?: number; - guildId?: string; - guildRoleId?: string; - guildRoleAction?: 'all' | 'any'; - url?: string; - comparison?: '>' | '<' | '>=' | '<=' | '==' | '!='; -}; - -export type ConditionBase = { - type?: ConditionType; - category?: string; - subcategory?: string; - data?: Data; - access?: Boolean; -}; - -export type Condition = ConditionBase & { - any?: ConditionBase[]; - all?: ConditionBase[]; -}; - -export interface Rules { - groupAccess?: { - conditions: Array<Condition | ConditionBase>; - }; - chatAccess?: { - conditions: Array<Condition | ConditionBase>; - }; -} -``` - <details> - <summary><b>Expected response (create space)</b></summary> + <summary><b>Expected response (remove Speakers to space)</b></summary> ```typescript -// PushAPI.space.create | Response - 200 OK +// PushAPI_space_remove_speakers | Response - 200 OK { members: [{ - wallet: 'eip155:0x727C819feB2c7F99c66d71B8411521bca2010023', + wallet: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + '\n' + - 'xsBNBGSrssEBCACg3ZjrZB40Xqr5IKIEtFldaeQyJPNwDACMekY77yApav0B\n' + - 'RwiqhFJDFJKcprSHg/vYdqalAIGRQ+J98VMBtHweurIubD/ODB6WknOms7ZY\n' + - '3ummaEzyFRombuq/C75o/0ImCi2v0PJBI3kdpwzOjiTt8S44yoAVOcTf9jyg\n' + - 'vTEVCOM81yqCf0mDB4t0jqRYewlQuJegORXDKHKTfZcnQybBkDYUGgmxOcyF\n' + - 'BaPMhSiWqAAqqb4gcFO2QKq69JoiE9dzSuF/7dvAq2QZRogC/GQW2Q9yQbq3\n' + - 'CvMNO4H2KUZzegaq2s2nMPGMXPNf4GZcZVJE1phWgAnApxTf5kUFfKr1ABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKuywQQLCQcICZDwrCS5ulOLwQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBFKpO7zcSRed+QmbIfCsJLm6U4vBAABZMwf+OIbBcFQ7x++1\n' + - 'NINOYbP9v0PyJvpllDcUORbk3uiPMpvDuQYAe2Fd4dY2Y91l3VdpIm/w6HQy\n' + - 'y81Y694w4E7PRVhDwHivv5D10VE9MF3h6qOHrLLpvdhpMaB5Ur8ts5rU2zOu\n' + - '64HR04/BVO9N0nrE9iywIgVMOy6IrS+OgK3r75PPX35bam/kbbmZHeygFaE9\n' + - '+mgQVdhwgF5borekIiz1Rc8CPA/P1yZy8QQl4KGmJEs+hOc5rPnUWwarvaAH\n' + - 'mPb6H0/mG81eXBOjpJlSFu6d/uqKLpoAw5fkvFoIsNwovYpyQkSbhzwe4T2N\n' + - 'jGqGd0+La03QdB5FbaiwcnJ96lU6oM7ATQRkq7LBAQgAxu9uK1+p62+/RvcF\n' + - 'Mz7g3A8SJiN76NYxk29sjQ9gW74B/IdPv5TlUVhG6PGr2c3SucASlEHieagY\n' + - 'CXM2+fpdu4rQ6EKRAe+30GFopfzhX1d0zv9d5BE6q1ML5mkrpDECH5iuqah7\n' + - 'smmbRdWE7zRSGaHyEfVqAG3wfMzzN0BcchxxR4vMCNKYLs9v2Q09ecO7DgaY\n' + - '5CZqxaFlTo+auuDhE0XU7WRbNL77izocV1Sm+McRyo28PrFTcrRRznD1nP0V\n' + - 'eZ4+aoulqyYA+gBBaIUdSA5kQXJiy67crB50yX3V6zLIfptD2ThHPjTY/inW\n' + - 'wVHVug4jIWUQ1QQw/q9qvGxAzQARAQABwsB2BBgBCAAqBYJkq7LBCZDwrCS5\n' + - 'ulOLwQKbDBYhBFKpO7zcSRed+QmbIfCsJLm6U4vBAADu6wf+NJDX/3NAxQKN\n' + - 'Iigj0GkBm/y69iFmQvWJxxtiYCNu8VBhm8MkcghUJ8G2tWP9ueUOM8sMTEa+\n' + - 'G+l+wSNwh/1yisF3FutDpy6l+fiy6kPPD4vl08jY3GrqSuWWfMxTJhMZ5D6v\n' + - 'OW2EfdyET+oP5eOnCd6p0EXP2ic48rVHDdU2iWeg0RkGvZP3t2LljWFdLbvw\n' + - 'h7+wSD1i4LY4slUIdbLdDSLN1gWFN1HXzX10mpX0grV2sBdfkNyHhF0WcIat\n' + - 'sD9HpAx2M62yP2D9D9UZVrW7WfmOoyL1NrnXSJsI8CRFDzujvpIrr7875zSi\n' + - 'VnxDVyt7twc7cYqRDHsNYuxAuE815A==\n' + - '=2jvb\n' + + 'xsBNBGSs6YABCADC4ldJKGpZ0Z+JJwA1t/1JWp5+dnR98nr7RHPX8eEGxIhL\n' + + 'gtx5TZmek2BcGzNcg66+GEyC4np9USaCZ4/YC9ZMLw8BQKzhOcd3ZILyGtGV\n' + + 'BijBNwjPIbQcy5/cXVtfKCvf303BDYddPYuJ1xFAh7kpvhcR4a72CSpeyEjM\n' + + 'UndteAVTIxqwdpnXIdqpwu6HrSJ089GpHV+XeaDo4Uhg+iHJsCRJy2VJ5m61\n' + + 'CwGx55f3ror6rAXQd+hEx+keLxYINNJLLvfvE9IGsIbKRFZx+emjXQZusbJp\n' + + 'zXYhJnEeHPLVDjWhzo8Q3/4gvOz8m6a+A9sl49sqodLdxVlXQ7d4CuylABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZKzpgAQLCQcICZCaDezdj8j4SwMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAACCLgf/dB412nDRcOxR\n' + + 'dNSj2AYknJ+NKeX38KuksyR6wypnaJWpapmIeZCfFjeoBjuBCPd6unvN/IlZ\n' + + 'zPwl66lO5GKJxDaDd1/infxM/dbtFQSESLXlweRLQ/v1+plsntrBUyvbY4uH\n' + + 'Mh9PImYsLY+zo8P5mpBV5AGAMA6R9qmu3axH/MnKVdB0Ky6C/jP+7lPs/QVT\n' + + 'qsISyyI1E9E6Oivzxmao1axfXLdEvICHb6uD0R4p5SUVqHJX41OwM8BFevhK\n' + + '07Hi+c7NhUWp0sxXEOs6dneJZwerCD3EahutpP1Oyt5T8MZitysn2yJ+s5ks\n' + + 'SZza+x8OmCMcMZfZnIsJNnIUvPboP87ATQRkrOmAAQgAteDgsJJ0ftPD+P15\n' + + 'rKgkLuSCD2iwQgm2k8/ZDaXJBsdm4sJYTt2y0ckx7MRpXgLuIyidOGctqVL6\n' + + '/Rl2Hfl30JQPok5cYmYLENVuFz94MEvgDOo8jacyfPdLGPMWZMLRojyM/Yvs\n' + + 'nhDZ8if3zEstP4h3HcpdT+PWSmsJWjrq57la4vKbfILtKfTBaf8sibm5UuZA\n' + + '5Y/SIPxfVC+ybCPAjo4tpDYP901V+wxXDJ8BlZ4AaVvk20MYMzuAjBna+iwD\n' + + 'f0j4CccEabd2EVtAQQcMCg2yTjOT22Dt0jfpDuohDNaXDhX2ZQlJIdlSLCEI\n' + + 'a3c7g+uU9bnNqt7LHPgMzLYKnwARAQABwsB2BBgBCAAqBYJkrOmACZCaDezd\n' + + 'j8j4SwKbDBYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAAD2vQgAu9+sd4AT5b6c\n' + + 'mWOaQBXz2XVfJXYQFNlBdOF23reycF9r7vDAKSRpeyMSyOfRAi0qdLynQ1dN\n' + + 'MXV/gfO0G9dzFu513P/Y1sZxQi0uLRKL9hMcgEQ8FLo8/PGfVcoLfQASryGj\n' + + 'Z8ybCFqiXocGpt2VkkK4wwgv+ZwZ8M1ubz0Boby6A1/kTYs/6ll+QekpB4ao\n' + + 'kJKw3DWvVNR/xODFfMQcClvzAtqwfxhTZXBMbZ4vAG5m1ExGmA15cGXrAfwV\n' + + 'nR2vOhPYDeZGbBKktM3xfDts75N2NF/TBpvazV2DTKpkLqvVitFHWvSMMpVd\n' + + 'dwk9tEOmBlj2AoYATvQ9kKHRTD27Wg==\n' + + '=IXzf\n' + '-----END PGP PUBLIC KEY BLOCK-----\n', isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA4klEQVR4AcXBoW3FMBRA0dsn75E9skAU6BkMSk1CA0xNsoBnMLSyQPbIDgVlLX0OcPX1Vb1zPj6/v35QWg5o61bQok+MHHVHazmgrVtBE4wJxgRjjofzmuj4xCuiT2iRCe2gJxgTjAnGXMuBTi2MRJ8YOerOSMsBTTAmGBOMuXUraNEntKPuaEfdeUX0iU4taIIxwZhgzPGH6BP/STAmGBOMOR6W+UY7r4l3LPONttITjAnGBGMu+kSnFrQlB96xbgUt+oQmGBOMCcYcDy0HRs5rYmSZb7SWA1pkQhOMCcYEY78uSjTZAXCkaQAAAABJRU5ErkJggg==' + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBoXHEMBRF0Zs3oqpHNYgJecZdGKYMd5GZRWaCwaohZbiAhP5d8HeC3jkfnz/fvwSTRua+DjJ1nGQ6i0iYCTNhVnjRWUSTRlTHyX90FhlhJsyEWeHFpJG5r4NMHSfRpBF1FpEwE2bCrPDGfR1E29jJPK6DqI6TjDATZsKsTBqZOk6iSa6ORmbSiISZMBNmpbOIHtcXUR0nUWeRmTSi+zqItrETCTNhJswKL7ax82wRTRqZzuLJ2MkIM2EmzApvTBpRZ5GZNKLOIiPMhJkw+wPV2i2sD43hKwAAAABJRU5ErkJggg==' }], pendingMembers: [{ - wallet: 'eip155:0x5f4e9e7Fcc17a943178c0b0881b09E8Ef9D34437', - publicKey: null, + wallet: 'eip155:0xC1469cB7b59d16dC887D4C11faB3E3C0abBeA12C', + publicKey: '', isSpeaker: false, - image: null + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsWnFMBSG0e9dBAGDPUs6LeAFNIEb1x5GtRtDei3gBQzZIFtYYEj10t73CkFw8Z/z+Pj+euJs14iXlsodJfd4U7fjGWKGmCEWzjnilUzTsB60nHOk5ZwjniFmiBligTdTt+MlIt52jbRVvKnb8RIRzxAzxAyxx+/nzxMhQ8wQM8RCyT0taancUXJPiyFmiBligTdTt+NNKy/OOdIyrAct2zXiGWKGmCEW0lJ5kUe8tFT+45wjXsk9XloqniFmiBliYVgPvHOOeCX33JGWijesB54hZogZYn8uFTTKoy9pgwAAAABJRU5ErkJggg==' }, { - wallet: 'eip155:0xFedfA2b276676C5c6ce753ddb4B05d00104E9236', - publicKey: null, + wallet: 'eip155:0xccF7a3131E0E73F83Bc457C27494411a57f23248', + publicKey: '', isSpeaker: false, - image: null + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9ElEQVR4AcXBIWoEMRSA4X8fw6qayBW9zULVEBFygLqcqMwdhlBCbKjqXSLjY7b2UZEVpbzvu3x8vT5QShhoqUa0Yz9ZSTWiHfuJ5rNDE4wJxgRjl8/v9wdKn43/dLve0QRjgjHB2NZnQ7td72h9NrQSBis+O7Tb9Y7WZ0MTjAnGBGMbv/TZ0EoYaD47VkoYaD43VgRjgjHB2MYTqUa0Yz9ZSTWi9dlYEYwJxgRjlzf38kDx2aGVMNBSjawc+4nms0MrYaAJxgRjgrGNJ1KNaH02VlKNaH02VgRjgjHB2OazQythoKXKn5Qw0Hx2aIIxwZhg7Ae2cUcV4Bl8pAAAAABJRU5ErkJggg==' + }, + { + wallet: 'eip155:0x052aD82D3a7b4DAb5b9BcFED771D28703a6faadf', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBoXFDQQxF0RtlkZsQNjHICKYYV7DFCAW6II2BycfbhklCNR/sTNA75+Pn+/MXIUPMEDPEBifhSVdr0oUnO7UmXXjS1Zp0hpghZogZYoaYIWaIDU5qTbrwpHtfnuyEJ12tyY4hZogZYiM86WpNdl7Hg53wL3bCk84QM8QMscFJeNLVmnS3652dOiZdeLJjiBlihtioNenCky486eqY7IQnO7UmnSFmiBliIzzpak262/XOf7wvT7rX8aALTzpDzBAzxP4AMOQyARcWaToAAAAASUVORK5CYII=' + }, + { + wallet: 'eip155:0x956f73E5a3BF0D19299BF74bD6dc819D7f775eC7', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsYnDMBiG4dc/nsHgHeJWS1x7G6QzqNQUKlUHLn12ONdqNYTBS/ja/xqBCeF7nmFbbydODoVPSjXiGWKGmCE2Pu8vvPT45pOe9xeeIWaIGWLj0Xa8HAo9qUZ6cih0tR3PEDPEDLFhW28nTg4FL9XIO3IoeKlGPEPMEDPEhq+f3xNnWmZ6jrbTMy0zPUfb8QwxQ8wQG6dlxjvajpdq5JLKPzkUvGmZ8QwxQ8wQG4+246Ua8XIovCPViJcpeIaYIWaIDdt6O7kgh0JPqpErDDFDzBD7AzabOPmHFg/aAAAAAElFTkSuQmCC' + }, + { + wallet: 'eip155:0x19da526eD1a57E07D48aa25aDa6cbA7E41FF3129', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyUlEQVR4AcXBsY1CQQxF0cvTFEHuNn4jxB6JJggpw5Mh/UZogmByumBTi2DQahf5nMN2vr1IjvtG1ufgL8Kc7Hm6k4liopgo1i7XB1nsG990uT7IRDFRTBRrfBDmZH0OVsKc3xDFRDFRrPFBn4MszFnpc5CFOSuimCgmih228+1Fctw3vul5upOJYqKYKNaO+0bW5yALc7I+BythTtbnIAtzMlFMFBPFGm/CnP8U5qyIYqKYKNZ40+dgJcxZ6XOwEuZkopgoJor9AIckL2mEiBQrAAAAAElFTkSuQmCC' + }, + { + wallet: 'eip155:0x77059B40Ec974883b98a23eef519b4076D1Cf9F1', + publicKey: '', + isSpeaker: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsY0CMRRF0cuTQ6rYaQFiAvdBYMkFkFEAwWYTryxZ2kIcEE8N1MKmH4JJRuw7Z/d7uD0JRu1EuRW2GLUT5VaIhJkwE2a788/XEyNhJsyEWcqtEI3a+aTcCpEwE2bCLI3aia77E9EyT2xxvDyIvmsnEmbCTJgl3izzRDRqJ8qtsGbUzou58KLeiYSZMBNmKbfCf8qtEAkzYSbM0qidTxq1s0aYCTNhlq77E9EyT2yRW2HN8fIgEmbCTJj9AUPBKWCCQlIAAAAAAElFTkSuQmCC' } ], - contractAddressERC20: "0x8Afa8FDf9fB545C8412499E8532C958086608b30", - numberOfERC20: 20, - contractAddressNFT: "0x42af3147f17239341477113484752D5D3dda997B", - numberOfNFTTokens: 2, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkq7LBCZDwrCS5ulOLwRYhBFKpO7zcSRed+QmbIfCsJLm6\n' + - 'U4vBAAAAHwf+K4f0gxaP56X4Cv2zlPWB9iUPi/1FOnx8ZF7oEf9xJSv/xA7v\n' + - '9LHBTZ2Y9AQlJpy0WLB7KGF7mVV1MdUKHjn2SFQ+1h+8d+FIHXfmB7Ie4alP\n' + - 'nnar6XjtMVKYyqXRzMzCq2F7Fjea1sUOXBxAeyJstAGG6nvsU51imaAtGQlQ\n' + - 'u7ih8D9UkiOe719v5GyI1vtiS+hHGlYo0+A7WVImH6SuVyPZ3UyPvLxXpeKs\n' + - '1SeEfuvfmKHbswm1DDGOknyo7fJ/QgKqOfkwsBIrYRNGwPGEKt8pHdwNxsNn\n' + - 'hNQtlFqtmtvieaxbhJQKXHbVgNv206xNsUBrK/U2nCakx7EMmxikFg==\n' + - '=tz9T\n' + - '-----END PGP SIGNATURE-----\n', + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkrOmCCZCaDezdj8j4SxYhBGZpOFBNtTj1Oqt695oN7N2P\n' + + 'yPhLAAD+iwf/dvaRCTwXKGH6iUe49NpyTHMaD6ZwaLerk+K4Ojehbdoo0mDf\n' + + 'aOu/MR8wfqk49h2436rcMmyeM5avcMgmtGUmIdy/6hCZ6zxR/3E5t/vq5UfO\n' + + '3YFO1VLghR5cTYqR9bMLFkvvCB4P29rnaok2QVKTBZLfyAM4wu1h2DDBESoz\n' + + 'SS+ZtQLPz6/y7gOQobO0zbwBPmy8MpVVu1wxht+sneOMvZX+5al679nQbwNL\n' + + 'oCcU3UKrlqMhuFgMTCKx99VLcc4JbhBf2M+IHf78NtQ9mcQC/X+gxRfp6f+p\n' + + '2RePQzkmUH5vqXjzcUsNBWJPOyjl09/IZWWwaeiUjsPazjxqDtYNHg==\n' + + '=H4X4\n' + + '-----END PGP SIGNATURE-----\n' + + ':null', spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'wasteful_indigo_warbler', + spaceName: 'sheer_ivory_ox', isPublic: true, - spaceDescription: 'boring_emerald_gamefowl', - spaceCreator: 'eip155:0x727C819feB2c7F99c66d71B8411521bca2010023', - spaceId: 'spaces:e0553610da88dacac70b406d1222a6881c0bde2c5129e58b526b5ae729d82116', + spaceDescription: 'specific_green_alpaca', + spaceCreator: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', + spaceId: 'spaces:bc96011f182e2c86ad68aaf4c95c4a916c808088370cb0ba294f9168e2ff6328', scheduleAt: '2023-07-15T14:48:00.000Z', scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING', - rules: { - 'spaceAccess': { - 'conditions': [ - { - 'any': [ - { - 'type': 'PUSH', - 'category': 'ERC20', - 'subcategory': 'holder', - 'data': { - 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', - 'amount': 1000, - 'decimals': 18 - } - }, - { - 'type': 'GUILD', - 'category': 'guildRoles', - 'subcategory': 'specificRole', - 'data': { - 'guildId': '13468', - 'guildRoleId': '19924' - } - } - ] - } - ] - } - } + status: 'PENDING' } - - ``` </details> --- -### **To check user access of a token gated group** +### **Fetching list of user spaces** ```typescript - -// actual api -const response = await PushAPI.space.getAccess({ - spaceId:'8f7be0068a677df166c2e5b8a9030fe8a4341807150339e588853c0049df3106', - did: '0x9e60c47edF21fa5e5Af33347680B3971F2FfD464' - env: 'staging', +const spaces = await PushAPI.space.spaces({ + account: string; + pgpPrivateKey?: string; + /** + * If true, the method will return decrypted message content in response + */ + toDecrypt?: boolean; + /** + * Environment variable + */ + env?: ENV; }); ``` -Allowed Options (params with \_ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId | string | - | space address | -| did | string | - | user address | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| - -<details> - <summary><b>Expected response (space access)</b></summary> - -```typescript -// PushAPI_chat_getSpaceAccess | Response - 200 OK -{ - 'spaceAccess': true, - 'rules': { - 'spaceAccess': { - 'conditions': [ - { - 'any': [ - { - 'type': 'PUSH', - 'category': 'ERC20', - 'subcategory': 'holder', - 'data': { - 'contract': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', - 'amount': 1000, - 'decimals': 18 - }, - 'access': false - }, - { - 'type': 'GUILD', - 'category': 'guildRoles', - 'subcategory': 'specificRole', - 'data': { - 'guildId': '13468', - 'guildRoleId': '19924' - }, - 'access': true - }, - { - 'type': 'PUSH', - 'category': 'ERC721', - 'subcategory': 'owner', - 'data': { - 'contract': 'eip155:5:0x42af3147f17239341477113484752D5D3dda997B', - 'amount': 1 - }, - 'access': true - } - ] - } - ] - } -} - -``` - -</details> - ---- - -### **To update space details** +| Param | Type | Default | Remarks | +| ------------- | ------- | ------- | ---------------------------------------------------------------------- | +| account | string | - | user address (Partial CAIP) | +| toDecrypt | boolean | false | if "true" the method will return decrypted message content in response | +| pgpPrivateKey | string | null | mandatory for users having pgp keys | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev' | -Note - updateSpace is an idompotent call +**Example normal user:** ```typescript // pre-requisite API calls that should be made before // need to get user and through that encryptedPvtKey of the user -const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); +const user = await PushAPI.user.get({ + account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', + env: ENV.STAGING, +}) // need to decrypt the encryptedPvtKey to pass in the api using helper function -const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); +const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: signer); // actual api -const response = await PushAPI.space.update({ - spaceId: 'spaces:e0553610da88dacac70b406d1222a6881c0bde2c5129e58b526b5ae729d82116', - spaceName: 'Push Space 3', - spaceDescription: 'This is the oficial space for Push Protocol', - listeners: ['0x2e60c47edF21fa5e5A333347680B3971F1FfD456','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - spaceImage: <group image link> , - speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: PushAPI.ChatStatus.PENDING, - account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', - env: 'staging', - pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key +const spaces = await PushAPI.space.spaces({ + account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', + toDecrypt: true, + pgpPrivateKey: pgpDecryptedPvtKey, + env: ENV.STAGING, }); ``` -### **To update token gated space details** - -Note - updateSpace is an idompotent call +**Example NFT user:** ```typescript -// pre-requisite API calls that should be made before -// need to get user and through that encryptedPvtKey of the user -const user = await PushAPI.user.get(account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', env: 'staging'); +// Fetch user +const user = await PushAPI.user.get({ + account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, + env: env as ENV, +}); -// need to decrypt the encryptedPvtKey to pass in the api using helper function -const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: _signer); +// Decrypt PGP Key +const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + signer: nftSigner, +}); -// actual api -const response = await PushAPI.space.update({ - spaceId: 'spaces:e0553610da88dacac70b406d1222a6881c0bde2c5129e58b526b5ae729d82116', - spaceName: 'Push Space 3', - spaceDescription: 'This is the oficial space for Push Protocol', - listeners: ['0x2e60c47edF21fa5e5A333347680B3971F1FfD456','0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - spaceImage: <group image link> , - speakers: ['0x3829E53A15856d1846e1b52d3Bdf5839705c29e5'], - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: PushAPI.ChatStatus.PENDING, - rules: { - 'groupAccess': { - 'conditions': [ - { - 'any': [ - { - 'type': 'PUSH', - 'category': 'ERC20', - 'subcategory': 'token_holder', - 'data': { - 'address': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', - 'amount': 1000, - 'decimals': 18 - } - }, - { - 'type': 'GUILD', - 'category': 'guildRoles', - 'subcategory': 'allRoles', - 'data': { - 'guildId': '13468' - } - } - ] - } - ] - }, - 'chatAccess': { - 'conditions': [ - { - 'all': [ - { - 'type': 'PUSH', - 'category': 'ERC20', - 'subcategory': 'token_holder', - 'data': { - 'address': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', - 'amount': 1000, - 'decimals': 18 - } - }, - { - 'type': 'GUILD', - 'category': 'guildRoles', - 'subcategory': 'specificRole', - 'data': { - 'guildId': '13468', - 'guildRoleId': '19924' - } - } - ] - } - ] - } - }, - account: '0xD993eb61B8843439A23741C0A3b5138763aE11a4', - env: 'staging', - pgpPrivateKey: pgpDecryptedPvtKey, //decrypted private key +// Actual api +const spaces = await PushAPI.space.spaces({ + account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, + toDecrypt: true, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, }); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | Id of the space | -| account* | string | - | user address | -| spaceName* | string | - | space name | -| spaceDescription* | string | - | space description | -| spaceImage* | string | - | space image | -| status* | string | - | space status - 'ACTIVE', 'PENDING', 'ENDED' | -| listeners* | Array<string> | - | wallet addresses of all listeners except speakers and spaceCreator | -| speakers* | Array<string> | - | wallet addresses of all speakers except listeners and spaceCreator | -| scheduleAt* | Date | - | Date time when the space is scheduled to start | -| scheduleEnd | Date | - | Date time when the space is scheduled to end | -| contractAddressERC20 (deprecated) | string | null | ERC20 Contract Address | -| numberOfERC20 (deprecated) | int | 0 | Minimum number of tokens required to join the space | -| contractAddressNFT (deprecated) | string | null | NFT Contract Address | -| numberOfNFTTokens (deprecated) | int | 0 | Minimum number of nfts required to join the space | -| rules | Rules | - | conditions for space and chat access (see format above) | -| pgpPrivateKey | string | null | mandatory for users having pgp keys| -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| - <details> - <summary><b>Expected response (update space)</b></summary> + <summary><b>Expected response (Get spaces of a specific user)</b></summary> ```typescript -// PushAPI.space.update | Response - 200 OK -{ - members: [ - { - wallet: 'eip155:0x367c6555b2CAD9C2d2656066EC3996Ba12cD058d', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + +// PushAPI_space_spaces | Response - 200 OK +// Array of spaces +[ + { + spaceId: + 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', + about: null, + did: null, + intent: + 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A+eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868', + intentSentBy: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + intentTimestamp: '2023-07-12T01:11:32.000Z', + publicKey: null, + profilePicture: null, + threadhash: null, + wallets: null, + combinedDID: + 'eip155:0x12E429E3672a02E385F9f5F75E932cC1D566EEea_eip155:0x49D407CC9D0e966CD9B22BA40685083B49bd2315_eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868_eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + name: null, + spaceInformation: { + members: [Array], + pendingMembers: [Array], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: + 'pgp:-----BEGIN PGP SIGNATURE-----\n' + '\n' + - 'xsBNBGSr17UBCADhEXWz/lsg0sDA+QRygzl+4t84/YYa459nzFRNB36jkbU8\n' + - 'FxRsE6oZTu0Leanup7aul4trJJ4qyA6xFfDjprDzrm1Gtp/gos46Lxk+br64\n' + - 'lzgqTfSKpBs9UWqOcr4Vnoq9WeOiFZax0DhN//7ibIQDWIJ0E6iOc8uiSoGZ\n' + - 's4AHTx7GtUvHxIUAk/hQY8UjjDNyhgCSrmdPeWt/SVbmFCHchdH/KhSK8JVq\n' + - 'qs8/nKx2Tm/nmAdWFZDqIJxd5tVuXXMxTZYZADZfmBltR2F/8GkF7hfX/aOo\n' + - 'gGQ/u2FPbCKRjtedfJi3WsPUKtyFg6QdwBnOQmYn0fGXlPGR7UVSsmIVABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKvXtQQLCQcICZD2NRrvru2XMgMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBM1nsbalDm3PtLAK2/Y1Gu+u7ZcyAADzuwgAmTBbnBQZ2w06\n' + - 'RbLmcZf8cYTof1X3mpYBa1lprMltib2jZQdu8DxhZBapYIE1O0UzV2Dy8IXj\n' + - 'zavtNFZiLR8FTwkrXQ3DGrZylnqjLkQ6m2jZsGIypb2OpTlBIBnjW98Dh99F\n' + - 'egI/5wse59IfGhYXVcKluKDAW2ezUJx8BhacZCwf/S8iG9YKrZctS5cVZxQw\n' + - 'SymXv88msoQrWhxmu2AT0rNsZ656ANMr/MuUjKMxQsoNCNIkp5kE0UTGfMwc\n' + - 'c69Gabs9uOPOqAGeSBGVfw+uJig/RJ4MWDCbj6QIDsV5FFRvTmJmmSNLNH5y\n' + - '83pHxE+923z6NiPWRonbns3pFNvhnc7ATQRkq9e1AQgAxjGMkGhs2OTW8fW/\n' + - '4tloJOID0UIDrz/24uX4JU+qjTqMzFyNGaNagT8n0xDH2E63YFmketip4QA2\n' + - '6kUBICKR2Y5kNNzkJXK4NYfa5OXEIS+lw+X7oMXd9YJ/D1fig1XD4Bf0ofsZ\n' + - 'QIxHOn6w3T/wQHOBpu+cqE3d0pW+6s6hZ4mkuPk6OXrkBSEtynk4ADQS+a3b\n' + - 'PrCGU9rJy2OnbP+lMr3onv/6BR/DFE4qCIfQt0cLu4nhAuYVYrOupi3p9eBQ\n' + - 'z/oWHCSNQVQSW2/vHp0YwMj2r3jSGdoZ3pcfy4iXOa7xEyeauOn/pHK+syOX\n' + - 'Pv64DHncql4AJFj9tw4rZ2/kkQARAQABwsB2BBgBCAAqBYJkq9e1CZD2NRrv\n' + - 'ru2XMgKbDBYhBM1nsbalDm3PtLAK2/Y1Gu+u7ZcyAADapwf/XF6I2NifyL/h\n' + - '2aVsr2lL2At732336je3WM6QnA/q1x9lmxX646c9eETUQvLLhT5RZmx1X8Fa\n' + - 'X/qGMKJe+BWLFPy5k6LnOezvvOxHGV+dzRndlWbnC9d3AZhThciw/Rd8V9W6\n' + - 'd6luo7+Apdd3rS17hG4gElhNX1drq5TuWR89yxA5oXcIqA+u3jBdpz0qo/ME\n' + - '+63r0AubixdM7rgV0skugaIXvqMKtfMC/V2A8mCL5AmRXCyfMBIsEA0L5YA1\n' + - 'wsKlHIQAy3jiPdY/2q5KUWJsR9o/IFirjnTd5vywtYsscOq/KnfLKdc2cVOr\n' + - 'e/vSkTOrD+dVTlxGhADoud4kvcOPtg==\n' + - '=6H2/\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBMU5DMRBF0cvI63FJETn7oXY3K3CBNHX2g/WFKKdnLdCOUnyEgnjnPH2+v35RXPagOsbmEZc9qI6xqQwxQ8wQa9w5xuYvHWNzxhAzxAyxxg8ynKrPxZkMp+pzccYQM8QMsZbhVH0uzmQ4j8hwKkPMEDPEWp+LKsOp+lxUGc6ZPhdVhlP1uagMMUPMEGsZzn/KcCpDzBAzxBp3+lxUGU718vzGmVtcqfpcVBlOZYgZYoZY63PxG7ePK4/oc1EZYoaYIfYN05Y0ReqpB6sAAAAASUVORK5CYII=' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0xB026B0A8BB1fea997a73c5a84fe7aF8cAab1AcF2', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA4ElEQVR4AcXBsU0EMRCG0Y+RC3ETzpwheqAFOnBmOZtSNqGC02abOaUAdwLp3AU+IYT+916+Pj6/CXLp/Kc1B5EhZogZYokn1hxEuXR21hxEuXR2DDFDzBBLuXSiNQdRaxeR+2CntYvIfRDl0okMMUPMEEs8cZw37pQbO8fJnUVlxxAzxAyxxINcOtGag7/IpbNjiBlihlh6f30jcq9EuXSiNQc7uXSiNQdRaxeRIWaIGWLJvRK1dhEdJ3dy6fxGaxeReyUyxAwxQyzxwL0SLSpRLp2dNQeRT7YMMUPMEPsB1yM4zt7CMugAAAAASUVORK5CYII=' + 'wsBzBAEBCAAnBYJkrksbCZA3GHnYNke0AhYhBNp+D95LDfs4yU03LzcYedg2\n' + + 'R7QCAACRdAf9ELAnCLXfBiAVdbgwj81xr+w9Yzw2wXLLrPLfYY7EXfyChLzQ\n' + + 'rr9XBDdWMgtzEU1diSPMbLDh1METR7n71EjG0AoeX5A2pkHI7R1vIxXUJR3G\n' + + 'fzHENsfGaKLnhrL1wLjBQACzEsIqPrHl9RItdtKEs9izLmc+wV0GFJ5OjbAs\n' + + 'ty/1Q36nnMB7sQ7Ytb9Op+q0TtZPZ7jF9CjX8KGav3P1xDQex9nfsXiDHlLK\n' + + 'MqDePaaMO6RJUWAP2xTo2k1DDJQ2dpUhs9XyjMlvFhVbIcT1/lVRCPC8V3C8\n' + + 'fUKhUejvOjNFxf0QuR+E4xs+Q3zvR1+fXdJBxbH2Fp3kOTN1N9/LEw==\n' + + '=sLLC\n' + + '-----END PGP SIGNATURE-----\n', + spaceImage: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'statutory_amber_roadrunner', + isPublic: true, + spaceDescription: 'continued_bronze_pigeon', + spaceCreator: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + spaceId: + 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', + scheduleAt: '2023-07-12T06:51:32.000Z', + scheduleEnd: '2023-07-12T07:41:32.000Z', + status: 'PENDING', }, - { - wallet: 'eip155:0x9b70FD7164ec0Ed3E1B3E318836522340dd2e125', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0UlEQVR4AcXBMWoDMRRF0ZtnkWYKgddgGKbSVrSILFBbUWUMLrICgwqXQ9L+NDKDIe+cj8+v7x+CPhpRyZV39NGISq5EwkyYCbN0f9z4a2Omj8ZMyZVo2Tei++NGJMyEmTBLz9OVqOTKTMmVIy7nlaiPRiTMhJkwS8u+8Z+WfSMSZsJMmKXLeWWmj0a07Bszz9OVqORKdDmvRMJMmAmzxAslV45ZOUKYCTNhlvpozJRcifpozJRcifpozAgzYSbMEi/00YhKrsz00ThCmAkzYfYLlLsvpsHyBx0AAAAASUVORK5CYII=' + msg: { + fromCAIP10: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', + toCAIP10: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', + fromDID: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', + toDID: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', + messageContent: "Gm gm! It's me... Mario", + messageType: 'Text', + signature: + '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkWKQWCZB7dzg7q3axjBYhBJFuYslzDGbuE+3FMnt3ODur\n' + + 'drGMAAAjtAf/TXjtm2qb6aSikFPKYXm0Ekws+65fisJGf7T48MYkkfcD4t2e\n' + + 'HXd9LtohzGhcztbOQfAND3yME1GWuMBIksq9rlyEA0ezwsGzCJVhBnkAHBe3\n' + + '+1v4/mNSMmInU8y6sOiLiOcW7ameJvZvDdPDJ0YHhc9dKDCIh1UAZEPAgx+z\n' + + 'Wc0DM6pW8bT70dfgnuW2LlLGF5Z23Z1vbHmeszt78+xYY3ez/hoMHXUIE25z\n' + + 'Wrnt75nasBBahtJ0mwH10ATnsQNE9hTi6XPGYxRSNDM9nyRxTQUpjhNmGS/+\n' + + '7oFyq8xTcRSaL7d3h8URp9hgFWher5ZZDyMV0jvk+HPguUX54g6Kgw==\n' + + '=dcRD\n' + + '-----END PGP SIGNATURE-----\n', + timestamp: 1683530775648, + sigType: 'pgp', + encType: 'pgp', + encryptedSecret: + '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMA9aU+JGZVRn/AQgA1pIJHyeJinU21r6At5S5ZaWeN0OEKVB2TjpqZ0IW\n' + + 'lHLKQrQ8k3M16bN+Vf0P+DzDVOL84QRkBD56qSNVHOOCox5wcQeR01CczenV\n' + + 'LUVvVjBzR2hj7Sdw+Q+M//rgeZPPUDbNyiVmGijelhwDqWd7IOoZY26AGXlm\n' + + '7YQiElvHN2HcYXaTlLAOy36BcccwHu3Tn06F77ZXaf8FnGMWOUy7wh1/jugg\n' + + 'D17jUZGLYbmw+u5l9BOfljbw2pb4vtjWht0I1b4GYlKb+bYg/NY0UNsq7mSh\n' + + 'dGAmOhy5tC2NMjLRRLfD2qasxHoHN50onlB6HcYLl0RCf31ebOgO6rMhUnxt\n' + + '9cHATAMLWLG2xubrYAEH/2tVeq2j7nJALGSFxjJPboOY57aiFrhXNQ/e/oXH\n' + + '//TNJgGWx4Ta++OuF2Oexbh9DIZhl6DWld9adXDDtBS/fEyjNsYqwoYlNEJN\n' + + 'kLvSmokNNrE4MKC1A0GkhSh2MGQDNk42GSgz1tep8XSVc98MHqfNXCHVb5Oa\n' + + 'OBeWKLFyElT3+KuZxSkCsnoO5YjuCGbXPyG06tXMHXMTncpj1ri+vpjUSnhD\n' + + 'wn3o0zpNWu0GaWXIgTqj2ZouVwV2S1+wAJQjE8uI1JvBiMhA+X63/GCcApBu\n' + + 'C7rN0Cs5NGXCn9VWp8i1SCp2NuZ38POABwsXUUkjpF24txyUDX8dbXlkzpao\n' + + 'g93SQAElYYmyKbGp1TKhAZl2u40mgf2yCYDv2DLRfAKMJDLvmjXoUGEg2UYO\n' + + '11w6LD0pIykdKJmFtRls/uMnlcoBgDA=\n' + + '=kzUH\n' + + '-----END PGP MESSAGE-----\n', + link: 'bafyreib34jgnpp573rwquejcq5avxvydis7fbykat6dd5z7uazobucoumm', }, - { - wallet: 'eip155:0x1A050099a08D7faf3b5923669a0FAe42A0872D72', - publicKey: null, - isSpeaker: false, - image: null - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkq9e1CZD2NRrvru2XMhYhBM1nsbalDm3PtLAK2/Y1Gu+u\n' + - '7ZcyAAA0igf/Tgo/WU4C5g4UtHPCwU/jThQwjElzCa96bZU8bCXsgnoO1NMI\n' + - 'fwI7FxIw8FmFrktHIWT10T/9vq2ItyUvpbWRhnD5zt5aRhJ1KA1z06iwkoUt\n' + - 'DLiPfveoSDyIhUIjx5PUMN0r/tXmLhj3CrkHx1hiPBxEkhi9brfFcOvX57HS\n' + - 'VOKOeeUa4G1cmk6dtzLHWT4p7ekrFhZPHXDtZUMZEU2wbMkB6bRqlZ7UYLbN\n' + - '7+0AvCu7uaCYG0zfbl3oZc6DkIm9jnBknsII6Hqv7Dc9NLAUBWo8tPrW2/KN\n' + - '8Bv/gk5HPb16tOihIUjs8v45wO3oTPAQYbJGdF6ta+HyiKO8JWipbw==\n' + - '=wkHz\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'mobile_aquamarine_constrictor', - isPublic: true, - spaceDescription: 'conventional_crimson_dove', - spaceCreator: 'eip155:0x367c6555b2CAD9C2d2656066EC3996Ba12cD058d', - spaceId: 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING', - rules: { - 'spaceAccess': { - 'conditions': [ - { - 'any': [ - { - 'type': 'PUSH', - 'category': 'ERC20', - 'subcategory': 'token_holder', - 'data': { - 'address': 'eip155:5:0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', - 'amount': 1000, - 'decimals': 18 - } - }, - { - 'type': 'GUILD', - 'category': 'guildRoles', - 'subcategory': 'specificRole', - 'data': { - 'guildId': '13468', - 'guildRoleId': '19924' - } - }, - { - 'type': 'PUSH', - 'category': 'ERC721', - 'subcategory': 'nft_owner', - 'data': { - 'address': 'eip155:5:0x42af3147f17239341477113484752D5D3dda997B', - 'amount': 1 - } - } - ] - } - ] - } - } -} + }, +]; ``` +| Parameter | Type | Description | +| ---------------- | -------------- | ------------------------------------------------------------------ | +| msg | `IMessageIPFS` | message object | +| did | `string` | user DID | +| wallets | `string` | user wallets | +| profilePicture | `string` | user profile picture | +| publicKey | `string` | user public key | +| about | `string` | user description | +| threadhash | `string` | cid from the latest message sent on this conversation | +| intent | `string` | addresses concatenated from the users who have approved the intent | +| intentSentBy | `string` | address of the user who sent the intent | +| intentTimestamp | `number` | timestamp of the intent | +| combinedDID | `string` | concatenated addresses of the members of this space | +| cid | `string` | content identifier on IPFS | +| spaceId | `string` | space identifier | +| spaceInformation | `SpaceDTO` | all space information | + </details> --- -### **To get space details by spaceId** +### **Fetching list of user space requests** ```typescript -const response = await PushAPI.space.get({ - spaceId: - 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', - env: 'staging', +const spaces = await PushAPI.space.requests({ + account: string; + pgpPrivateKey?: string; + /** + * If true, the method will return decrypted message content in response + */ + toDecrypt?: boolean; + /** + * Environment variable + */ + env?: ENV; }); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| Param | Type | Default | Remarks | +| ------------- | ------- | ------- | ---------------------------------------------------------------------- | +| account | string | - | user address (Partial CAIP) | +| toDecrypt | boolean | false | if "true" the method will return decrypted message content in response | +| pgpPrivateKey | string | null | mandatory for users having pgp keys | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev' | -<details> - <summary><b>Expected response (get space by space id)</b></summary> +**Example normal user:** ```typescript -// PushAPI_space_get | Response - 200 OK -{ - members: [ - { - wallet: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGSr528BCADI8kQcWkaw9PKmSrwCtPBDWj+wzPhmok9jAzxzb2+qAjSV\n' + - 'rYdIrnx6PAp1rMU6qoVg4cdDbCYPV+kCj8l3lUzH/a/SfPsDWpspA/ICWMeS\n' + - 'dMdGYxHLk2gsu0wRz69qoddXMY1h5eMZEyRnr2fsX/cy15mxO2IEHYnC2/rp\n' + - '06iFpx1T8k5HWgFDpyleWyMSQ7Bnn7GutrlHYEVtIGVfXDSkea8IDLLkzBEV\n' + - '3jlBUFhpsrlcvDwDYcMYOrqSBEtg1a+GMK+2Ye/hF37KUYTAPleKXeN0cYIs\n' + - 'Va8oleZK960XYfuy5SYCJav2kaAggNWQBie5G9C4H3h7FuFwWk8LH3DhABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKvnbwQLCQcICZBm9Bz6DvB6DwMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAAAkiQgAukm3owebckwr\n' + - 'xAR42r/+CBx1uoqM2ZeEAUeYtBF7sdLEsdxFrxl8wHKAbglZwtgWcfG95v2R\n' + - 'zLcBco3v9p0IuS6DZduIfhngZ49gpYwqFGyiCOvo+k14tuMbrbOZTTKp0uc6\n' + - 'icpTyP8/1U0nZrQmmSXyfh6Hgmx1OnW3zTM7oUN1ZVvj3V6rOl+ktUPjAaYo\n' + - 'CWJjth92xhDWEPZnC/4Gz2eRoTVtmx8u+/2vNPffQVgzzHznUxB+G5XeZmPk\n' + - 'z8oxxSxII8PNiAs5LizqPjyq2gEv25GlCsMXTYz60n/t/4G7Yc94yu8xD8u3\n' + - 'BpWluHC2eW0pYFcDfiNLfv0uJCrUcM7ATQRkq+dvAQgA7v7Zz4CZdPsd4jvB\n' + - 'uDwjop/Gvoz+rbvAdS3Xrsi+OTyrWAqidnXChhwExlUNelZ9v52lGxe1twwr\n' + - 'vxeQ4M0pv4oqSlZxhkqBCyj+E7ECR2WXG7ccLlzYOz3b5BXT+fEkmVsbVTjA\n' + - 'Kttjosm7FtY4igY2Hu4UlZZW8M1tYL1R/UegFeMYGY7aO7dcKeiP0NsDwm3c\n' + - '0SiU6/JlOXAIi/ZSKDJ4b5BPK6GFj5pNWr92/V7LejlZfoHAVDbb91tiPGdP\n' + - 'y3+r9T3IYsgUDLgOpPQn6o82Nctm6CnIZqAN12nJ1DEJP2JyLDedg9b5H+aa\n' + - 'FDZFc7yQ3In/QPtjHImydLt9NwARAQABwsB2BBgBCAAqBYJkq+dvCZBm9Bz6\n' + - 'DvB6DwKbDBYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAABRUQf+KoF4UXuseLBO\n' + - 'd0PD0+hEcnsYbaPWmPZtJPWusxPl6kt421luymPiThDXwaMVzRrmxkz0dNZ3\n' + - 'bUFYtS24t2BhlXZ6cGFNRjXrA9OV0kLg/kNm1vboQ1GL8qRV9CIjPVEpksQp\n' + - 'tOiYN+X+/2XdPJkaQpITHIFV067qWQSAKIonvOI8OJYOovGRQTInz0VE71Yn\n' + - 'SeiOilKBK+p2RN38jGr0PGWt740KJ6560FzfUwTAQzz9vrkYa+vEhWe+bzOd\n' + - 'YBpxj/BRTGR19DrKlGcFPdTYz5ADxCjBuCxXgoRCbBiWwh+iIstk5qkT8uHK\n' + - 'NQjzDvo3RO1cROQp0zsikladmzGZHQ==\n' + - '=q/e/\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA10lEQVR4AcXBsWnFMBSG0c8/brOD9kgfogHUGQIuAppInSsVAQ2gdbSD64fTXl4hMI/HPWf5fXxf3DDaxkxIlTuEM+FMOFt5MtqG1XvBipGpsp9YMWaskCqWcCacCWfL4+fzwogx8069FyzhTDgTzpavv3oxEVLlFaNtzAhnwplwtvIkpIpV9hMrxsxM7wUrHxVrtA1LOBPOhLM1pIo12oaVj4rV98JMPj6wRtuwQqpYwplwJpyt3BRjZiZQuUM4E86Es7XsJ1aMTIVUeUXZTyzhTDgTzv4BnGY033BWusUAAAAASUVORK5CYII=' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0xaC6C69c657cF6022fa787B14BDdaA22936B56D65', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA2UlEQVR4AcXBQWoEIRBA0Z+ikOwNDHirbARPKDiLvkzOIATaC4iQbGt6ITSzqPc+np8/fxhpVazzcfCOr99vrK4FS3AmOBOcKRddCy9GwQoxszNHw+rKluBMcCY407QqO10L1hyNO9Kq7AjOBGeCMz0fB9YcjZ20KjtdC1bXghVixhKcCc4EZzpH446uhXfM0bAEZ4IzwZmGmLHmaOyEmNmZo7ETYsYSnAnOBGfKRVoVq2vBmqNxR1oV6+SV4ExwJjhTLroWdkLM7MzRsLoWrMCBJTgTnAnO/gGd1jrTKk/8EAAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xEf532414907E8c631307c0d501cDe6D1694bAF5e', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBobHDMBBF0ZsdjftIDeGuIkzIaGsQC1MNQkZirsLcnaQCk3yqBOzMH4N3zu11f38I+GPiinacRAwxQ8wQS/zo1flSGqNenUgujVGvziiXxsgQM8QMscSPXBqjXp1RLo1Ir84ol0bEEDPEDLHkj4lI51uvzn/4YyJiiBlihlhqx0lkZ2U0Pxci+7YyasdJxBAzxAyx1KsT8W3lil6diCFmiBlit9f9/SHQq3NFLo2IIWaIGWKpVyeybyuj+bkQ2beV0VwXIoaYIWaI/QH8GTSs76EUEQAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0x2F5f27B523C8888eA79b7FA80a9CbA6b6980784c', - publicKey: null, - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW3DQAxA0W9CExjIDhogfboDCw9gICvcHmldcIAMoYLgJJ5CKzgto4KA4ILvXT5+Pl8kwydZqJHt60bl+ryRDZ9koUYmNBOaCc0u31+/L04INSrDJ2cIzYRmQrMl1Dhj+KQSapwhNBOaCc0WDvZ1o+ROZV83KtfnjUxoJjQTmi0c3B/OO+4PpxLKP0IzoZnQbBk+yUKNyvBJJdSoDJ9kQjOhmdBsCTWy4ZNKqFEZPqmEGpnQTGgmNFs4CDWy4ZN3hBoVoZnQTGj2BxvbMvuaMCXUAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkq+dvCZBm9Bz6DvB6DxYhBPkdSvwnOBuAJaOWAGb0HPoO\n' + - '8HoPAAD5ywf/cvaGM0DzcB22Q2FMzUZG4/ZmkN4OknvSj0d4hB/sPUIb9176\n' + - 'z+niFMjWZNFpIj8s36f16oMEZZ+Eleu9t6sECBxRDvO8pEwyByCXSmz8e/SH\n' + - 'Y659cvg5/A3bSe0FqR0VTI1o+Uz2BpnXG/P38C6D46btaIaJcr4cIh88wQ9J\n' + - 'lr05hOE7w/7Uo5OwyXala0NfB+8S4LIfpC2OlPOhyHQEJd2+WoFKb/6dO28D\n' + - 'TLuvgYJXJfc4R3ElcgFfm1N9ylG0Pt1F3c0C/k9bNokR2PVXgX2XSTQsx1rD\n' + - 'MCY/ePr93INyNZuTPcPlK87X6OTa2/gEW161vup2Xn2Did9HtL76Qw==\n' + - '=EkOP\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'intellectual_green_bat', - isPublic: true, - spaceDescription: 'sad_purple_pinniped', - spaceCreator: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', - spaceId: 'spaces:9dab226c7920fe06154d76f78dfe1187bdc4fda712cdd9a8b37cc6a99741a63b', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING' -} -``` +// pre-requisite API calls that should be made before +// need to get user and through that encryptedPvtKey of the user +const user = await PushAPI.user.get({ + account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', + env: ENV.STAGING, +}) -</details> +// need to decrypt the encryptedPvtKey to pass in the api using helper function +const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: signer); ---- +// actual api +const spaces = await PushAPI.space.requests({ + account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', + toDecrypt: true, + pgpPrivateKey: pgpDecryptedPvtKey, + env: ENV.STAGING, +}); +``` -### **To start a space** +**Example NFT user:** ```typescript -const response = await PushAPI.space.start({ - spaceId: - 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', - env: 'staging', +// Fetch user +const user = await PushAPI.user.get({ + account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, + env: env as ENV, }); -``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +// Decrypt PGP Key +const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + signer: nftSigner, +}); + +// Actual api +const spaces = await PushAPI.space.requests({ + account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, + toDecrypt: true, + pgpPrivateKey: pgpDecrpyptedPvtKey, + env: env as ENV, +}); +``` <details> - <summary><b>Expected response (start space by space id)</b></summary> + <summary><b>Expected response (Get spaces requests of a specific user)</b></summary> ```typescript -// PushAPI_space_start | Response - 200 OK -{ - members: [ - { - wallet: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + +// PushAPI_space_requests | Response - 200 OK +// Array of spaces +[ + { + spaceId: + 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', + about: null, + did: null, + intent: + 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A+eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868', + intentSentBy: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + intentTimestamp: '2023-07-12T01:11:32.000Z', + publicKey: null, + profilePicture: null, + threadhash: null, + wallets: null, + combinedDID: + 'eip155:0x12E429E3672a02E385F9f5F75E932cC1D566EEea_eip155:0x49D407CC9D0e966CD9B22BA40685083B49bd2315_eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868_eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + name: null, + spaceInformation: { + members: [Array], + pendingMembers: [Array], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: + 'pgp:-----BEGIN PGP SIGNATURE-----\n' + '\n' + - 'xsBNBGSr528BCADI8kQcWkaw9PKmSrwCtPBDWj+wzPhmok9jAzxzb2+qAjSV\n' + - 'rYdIrnx6PAp1rMU6qoVg4cdDbCYPV+kCj8l3lUzH/a/SfPsDWpspA/ICWMeS\n' + - 'dMdGYxHLk2gsu0wRz69qoddXMY1h5eMZEyRnr2fsX/cy15mxO2IEHYnC2/rp\n' + - '06iFpx1T8k5HWgFDpyleWyMSQ7Bnn7GutrlHYEVtIGVfXDSkea8IDLLkzBEV\n' + - '3jlBUFhpsrlcvDwDYcMYOrqSBEtg1a+GMK+2Ye/hF37KUYTAPleKXeN0cYIs\n' + - 'Va8oleZK960XYfuy5SYCJav2kaAggNWQBie5G9C4H3h7FuFwWk8LH3DhABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKvnbwQLCQcICZBm9Bz6DvB6DwMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAAAkiQgAukm3owebckwr\n' + - 'xAR42r/+CBx1uoqM2ZeEAUeYtBF7sdLEsdxFrxl8wHKAbglZwtgWcfG95v2R\n' + - 'zLcBco3v9p0IuS6DZduIfhngZ49gpYwqFGyiCOvo+k14tuMbrbOZTTKp0uc6\n' + - 'icpTyP8/1U0nZrQmmSXyfh6Hgmx1OnW3zTM7oUN1ZVvj3V6rOl+ktUPjAaYo\n' + - 'CWJjth92xhDWEPZnC/4Gz2eRoTVtmx8u+/2vNPffQVgzzHznUxB+G5XeZmPk\n' + - 'z8oxxSxII8PNiAs5LizqPjyq2gEv25GlCsMXTYz60n/t/4G7Yc94yu8xD8u3\n' + - 'BpWluHC2eW0pYFcDfiNLfv0uJCrUcM7ATQRkq+dvAQgA7v7Zz4CZdPsd4jvB\n' + - 'uDwjop/Gvoz+rbvAdS3Xrsi+OTyrWAqidnXChhwExlUNelZ9v52lGxe1twwr\n' + - 'vxeQ4M0pv4oqSlZxhkqBCyj+E7ECR2WXG7ccLlzYOz3b5BXT+fEkmVsbVTjA\n' + - 'Kttjosm7FtY4igY2Hu4UlZZW8M1tYL1R/UegFeMYGY7aO7dcKeiP0NsDwm3c\n' + - '0SiU6/JlOXAIi/ZSKDJ4b5BPK6GFj5pNWr92/V7LejlZfoHAVDbb91tiPGdP\n' + - 'y3+r9T3IYsgUDLgOpPQn6o82Nctm6CnIZqAN12nJ1DEJP2JyLDedg9b5H+aa\n' + - 'FDZFc7yQ3In/QPtjHImydLt9NwARAQABwsB2BBgBCAAqBYJkq+dvCZBm9Bz6\n' + - 'DvB6DwKbDBYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAABRUQf+KoF4UXuseLBO\n' + - 'd0PD0+hEcnsYbaPWmPZtJPWusxPl6kt421luymPiThDXwaMVzRrmxkz0dNZ3\n' + - 'bUFYtS24t2BhlXZ6cGFNRjXrA9OV0kLg/kNm1vboQ1GL8qRV9CIjPVEpksQp\n' + - 'tOiYN+X+/2XdPJkaQpITHIFV067qWQSAKIonvOI8OJYOovGRQTInz0VE71Yn\n' + - 'SeiOilKBK+p2RN38jGr0PGWt740KJ6560FzfUwTAQzz9vrkYa+vEhWe+bzOd\n' + - 'YBpxj/BRTGR19DrKlGcFPdTYz5ADxCjBuCxXgoRCbBiWwh+iIstk5qkT8uHK\n' + - 'NQjzDvo3RO1cROQp0zsikladmzGZHQ==\n' + - '=q/e/\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA10lEQVR4AcXBsWnFMBSG0c8/brOD9kgfogHUGQIuAppInSsVAQ2gdbSD64fTXl4hMI/HPWf5fXxf3DDaxkxIlTuEM+FMOFt5MtqG1XvBipGpsp9YMWaskCqWcCacCWfL4+fzwogx8069FyzhTDgTzpavv3oxEVLlFaNtzAhnwplwtvIkpIpV9hMrxsxM7wUrHxVrtA1LOBPOhLM1pIo12oaVj4rV98JMPj6wRtuwQqpYwplwJpyt3BRjZiZQuUM4E86Es7XsJ1aMTIVUeUXZTyzhTDgTzv4BnGY033BWusUAAAAASUVORK5CYII=' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0xaC6C69c657cF6022fa787B14BDdaA22936B56D65', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA2UlEQVR4AcXBQWoEIRBA0Z+ikOwNDHirbARPKDiLvkzOIATaC4iQbGt6ITSzqPc+np8/fxhpVazzcfCOr99vrK4FS3AmOBOcKRddCy9GwQoxszNHw+rKluBMcCY407QqO10L1hyNO9Kq7AjOBGeCMz0fB9YcjZ20KjtdC1bXghVixhKcCc4EZzpH446uhXfM0bAEZ4IzwZmGmLHmaOyEmNmZo7ETYsYSnAnOBGfKRVoVq2vBmqNxR1oV6+SV4ExwJjhTLroWdkLM7MzRsLoWrMCBJTgTnAnO/gGd1jrTKk/8EAAAAABJRU5ErkJggg==' + 'wsBzBAEBCAAnBYJkrksbCZA3GHnYNke0AhYhBNp+D95LDfs4yU03LzcYedg2\n' + + 'R7QCAACRdAf9ELAnCLXfBiAVdbgwj81xr+w9Yzw2wXLLrPLfYY7EXfyChLzQ\n' + + 'rr9XBDdWMgtzEU1diSPMbLDh1METR7n71EjG0AoeX5A2pkHI7R1vIxXUJR3G\n' + + 'fzHENsfGaKLnhrL1wLjBQACzEsIqPrHl9RItdtKEs9izLmc+wV0GFJ5OjbAs\n' + + 'ty/1Q36nnMB7sQ7Ytb9Op+q0TtZPZ7jF9CjX8KGav3P1xDQex9nfsXiDHlLK\n' + + 'MqDePaaMO6RJUWAP2xTo2k1DDJQ2dpUhs9XyjMlvFhVbIcT1/lVRCPC8V3C8\n' + + 'fUKhUejvOjNFxf0QuR+E4xs+Q3zvR1+fXdJBxbH2Fp3kOTN1N9/LEw==\n' + + '=sLLC\n' + + '-----END PGP SIGNATURE-----\n', + spaceImage: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'statutory_amber_roadrunner', + isPublic: true, + spaceDescription: 'continued_bronze_pigeon', + spaceCreator: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + spaceId: + 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', + scheduleAt: '2023-07-12T06:51:32.000Z', + scheduleEnd: '2023-07-12T07:41:32.000Z', + status: 'PENDING', }, - { - wallet: 'eip155:0xEf532414907E8c631307c0d501cDe6D1694bAF5e', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBobHDMBBF0ZsdjftIDeGuIkzIaGsQC1MNQkZirsLcnaQCk3yqBOzMH4N3zu11f38I+GPiinacRAwxQ8wQS/zo1flSGqNenUgujVGvziiXxsgQM8QMscSPXBqjXp1RLo1Ir84ol0bEEDPEDLHkj4lI51uvzn/4YyJiiBlihlhqx0lkZ2U0Pxci+7YyasdJxBAzxAyx1KsT8W3lil6diCFmiBlit9f9/SHQq3NFLo2IIWaIGWKpVyeybyuj+bkQ2beV0VwXIoaYIWaI/QH8GTSs76EUEQAAAABJRU5ErkJggg==' + msg: { + fromCAIP10: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', + toCAIP10: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', + fromDID: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', + toDID: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', + messageContent: "Gm gm! It's me... Mario", + messageType: 'Text', + signature: + '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkWKQWCZB7dzg7q3axjBYhBJFuYslzDGbuE+3FMnt3ODur\n' + + 'drGMAAAjtAf/TXjtm2qb6aSikFPKYXm0Ekws+65fisJGf7T48MYkkfcD4t2e\n' + + 'HXd9LtohzGhcztbOQfAND3yME1GWuMBIksq9rlyEA0ezwsGzCJVhBnkAHBe3\n' + + '+1v4/mNSMmInU8y6sOiLiOcW7ameJvZvDdPDJ0YHhc9dKDCIh1UAZEPAgx+z\n' + + 'Wc0DM6pW8bT70dfgnuW2LlLGF5Z23Z1vbHmeszt78+xYY3ez/hoMHXUIE25z\n' + + 'Wrnt75nasBBahtJ0mwH10ATnsQNE9hTi6XPGYxRSNDM9nyRxTQUpjhNmGS/+\n' + + '7oFyq8xTcRSaL7d3h8URp9hgFWher5ZZDyMV0jvk+HPguUX54g6Kgw==\n' + + '=dcRD\n' + + '-----END PGP SIGNATURE-----\n', + timestamp: 1683530775648, + sigType: 'pgp', + encType: 'pgp', + encryptedSecret: + '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMA9aU+JGZVRn/AQgA1pIJHyeJinU21r6At5S5ZaWeN0OEKVB2TjpqZ0IW\n' + + 'lHLKQrQ8k3M16bN+Vf0P+DzDVOL84QRkBD56qSNVHOOCox5wcQeR01CczenV\n' + + 'LUVvVjBzR2hj7Sdw+Q+M//rgeZPPUDbNyiVmGijelhwDqWd7IOoZY26AGXlm\n' + + '7YQiElvHN2HcYXaTlLAOy36BcccwHu3Tn06F77ZXaf8FnGMWOUy7wh1/jugg\n' + + 'D17jUZGLYbmw+u5l9BOfljbw2pb4vtjWht0I1b4GYlKb+bYg/NY0UNsq7mSh\n' + + 'dGAmOhy5tC2NMjLRRLfD2qasxHoHN50onlB6HcYLl0RCf31ebOgO6rMhUnxt\n' + + '9cHATAMLWLG2xubrYAEH/2tVeq2j7nJALGSFxjJPboOY57aiFrhXNQ/e/oXH\n' + + '//TNJgGWx4Ta++OuF2Oexbh9DIZhl6DWld9adXDDtBS/fEyjNsYqwoYlNEJN\n' + + 'kLvSmokNNrE4MKC1A0GkhSh2MGQDNk42GSgz1tep8XSVc98MHqfNXCHVb5Oa\n' + + 'OBeWKLFyElT3+KuZxSkCsnoO5YjuCGbXPyG06tXMHXMTncpj1ri+vpjUSnhD\n' + + 'wn3o0zpNWu0GaWXIgTqj2ZouVwV2S1+wAJQjE8uI1JvBiMhA+X63/GCcApBu\n' + + 'C7rN0Cs5NGXCn9VWp8i1SCp2NuZ38POABwsXUUkjpF24txyUDX8dbXlkzpao\n' + + 'g93SQAElYYmyKbGp1TKhAZl2u40mgf2yCYDv2DLRfAKMJDLvmjXoUGEg2UYO\n' + + '11w6LD0pIykdKJmFtRls/uMnlcoBgDA=\n' + + '=kzUH\n' + + '-----END PGP MESSAGE-----\n', + link: 'bafyreib34jgnpp573rwquejcq5avxvydis7fbykat6dd5z7uazobucoumm', }, - { - wallet: 'eip155:0x2F5f27B523C8888eA79b7FA80a9CbA6b6980784c', - publicKey: null, - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW3DQAxA0W9CExjIDhogfboDCw9gICvcHmldcIAMoYLgJJ5CKzgto4KA4ILvXT5+Pl8kwydZqJHt60bl+ryRDZ9koUYmNBOaCc0u31+/L04INSrDJ2cIzYRmQrMl1Dhj+KQSapwhNBOaCc0WDvZ1o+ROZV83KtfnjUxoJjQTmi0c3B/OO+4PpxLKP0IzoZnQbBk+yUKNyvBJJdSoDJ9kQjOhmdBsCTWy4ZNKqFEZPqmEGpnQTGgmNFs4CDWy4ZN3hBoVoZnQTGj2BxvbMvuaMCXUAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkq+dvCZBm9Bz6DvB6DxYhBPkdSvwnOBuAJaOWAGb0HPoO\n' + - '8HoPAAD5ywf/cvaGM0DzcB22Q2FMzUZG4/ZmkN4OknvSj0d4hB/sPUIb9176\n' + - 'z+niFMjWZNFpIj8s36f16oMEZZ+Eleu9t6sECBxRDvO8pEwyByCXSmz8e/SH\n' + - 'Y659cvg5/A3bSe0FqR0VTI1o+Uz2BpnXG/P38C6D46btaIaJcr4cIh88wQ9J\n' + - 'lr05hOE7w/7Uo5OwyXala0NfB+8S4LIfpC2OlPOhyHQEJd2+WoFKb/6dO28D\n' + - 'TLuvgYJXJfc4R3ElcgFfm1N9ylG0Pt1F3c0C/k9bNokR2PVXgX2XSTQsx1rD\n' + - 'MCY/ePr93INyNZuTPcPlK87X6OTa2/gEW161vup2Xn2Did9HtL76Qw==\n' + - '=EkOP\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'intellectual_green_bat', - isPublic: true, - spaceDescription: 'sad_purple_pinniped', - spaceCreator: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', - spaceId: 'spaces:9dab226c7920fe06154d76f78dfe1187bdc4fda712cdd9a8b37cc6a99741a63b', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'ACTIVE' -} + }, +]; ``` +| Parameter | Type | Description | +| ---------------- | -------------- | ------------------------------------------------------------------ | +| msg | `IMessageIPFS` | message object | +| did | `string` | user DID | +| wallets | `string` | user wallets | +| profilePicture | `string` | user profile picture | +| publicKey | `string` | user public key | +| about | `string` | user description | +| threadhash | `string` | cid from the latest message sent on this conversation | +| intent | `string` | addresses concatenated from the users who have approved the intent | +| intentSentBy | `string` | address of the user who sent the intent | +| intentTimestamp | `number` | timestamp of the intent | +| combinedDID | `string` | concatenated addresses of the members of this space | +| cid | `string` | content identifier on IPFS | +| spaceId | `string` | space identifier | +| spaceInformation | `SpaceDTO` | all space information | + </details> --- -### **To stop a space** +### **Fetching list of trending spaces** ```typescript -const response = await PushAPI.space.stop({ - spaceId: - 'spaces:108f766a5053e2b985d0843e806f741da5ad754d128aff0710e526eebc127afc', - env: 'staging', +const spaces = await PushAPI.space.trending({ + env?: ENV; }); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| Param | Type | Default | Remarks | +| ----- | ------ | ------- | ---------------------------------- | +| env | string | 'prod' | API env - 'prod', 'staging', 'dev' | +| page | number | 1 | page index of the results | +| limit | number | 10 | number of items in 1 page | <details> - <summary><b>Expected response (stop space by space id)</b></summary> + + <summary><b>Expected response (Get trending spaces)</b></summary> ```typescript -// PushAPI_space_stop | Response - 200 OK -{ - members: [ - { - wallet: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + +// PushAPI_space_trending | Response - 200 OK +// Array of spaces +[ + { + spaceId: + 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', + about: null, + did: null, + intent: + 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A+eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868', + intentSentBy: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + intentTimestamp: '2023-07-12T01:11:32.000Z', + publicKey: null, + profilePicture: null, + threadhash: null, + wallets: null, + combinedDID: + 'eip155:0x12E429E3672a02E385F9f5F75E932cC1D566EEea_eip155:0x49D407CC9D0e966CD9B22BA40685083B49bd2315_eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868_eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + name: null, + spaceInformation: { + members: [Array], + pendingMembers: [Array], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: + 'pgp:-----BEGIN PGP SIGNATURE-----\n' + '\n' + - 'xsBNBGSr528BCADI8kQcWkaw9PKmSrwCtPBDWj+wzPhmok9jAzxzb2+qAjSV\n' + - 'rYdIrnx6PAp1rMU6qoVg4cdDbCYPV+kCj8l3lUzH/a/SfPsDWpspA/ICWMeS\n' + - 'dMdGYxHLk2gsu0wRz69qoddXMY1h5eMZEyRnr2fsX/cy15mxO2IEHYnC2/rp\n' + - '06iFpx1T8k5HWgFDpyleWyMSQ7Bnn7GutrlHYEVtIGVfXDSkea8IDLLkzBEV\n' + - '3jlBUFhpsrlcvDwDYcMYOrqSBEtg1a+GMK+2Ye/hF37KUYTAPleKXeN0cYIs\n' + - 'Va8oleZK960XYfuy5SYCJav2kaAggNWQBie5G9C4H3h7FuFwWk8LH3DhABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKvnbwQLCQcICZBm9Bz6DvB6DwMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAAAkiQgAukm3owebckwr\n' + - 'xAR42r/+CBx1uoqM2ZeEAUeYtBF7sdLEsdxFrxl8wHKAbglZwtgWcfG95v2R\n' + - 'zLcBco3v9p0IuS6DZduIfhngZ49gpYwqFGyiCOvo+k14tuMbrbOZTTKp0uc6\n' + - 'icpTyP8/1U0nZrQmmSXyfh6Hgmx1OnW3zTM7oUN1ZVvj3V6rOl+ktUPjAaYo\n' + - 'CWJjth92xhDWEPZnC/4Gz2eRoTVtmx8u+/2vNPffQVgzzHznUxB+G5XeZmPk\n' + - 'z8oxxSxII8PNiAs5LizqPjyq2gEv25GlCsMXTYz60n/t/4G7Yc94yu8xD8u3\n' + - 'BpWluHC2eW0pYFcDfiNLfv0uJCrUcM7ATQRkq+dvAQgA7v7Zz4CZdPsd4jvB\n' + - 'uDwjop/Gvoz+rbvAdS3Xrsi+OTyrWAqidnXChhwExlUNelZ9v52lGxe1twwr\n' + - 'vxeQ4M0pv4oqSlZxhkqBCyj+E7ECR2WXG7ccLlzYOz3b5BXT+fEkmVsbVTjA\n' + - 'Kttjosm7FtY4igY2Hu4UlZZW8M1tYL1R/UegFeMYGY7aO7dcKeiP0NsDwm3c\n' + - '0SiU6/JlOXAIi/ZSKDJ4b5BPK6GFj5pNWr92/V7LejlZfoHAVDbb91tiPGdP\n' + - 'y3+r9T3IYsgUDLgOpPQn6o82Nctm6CnIZqAN12nJ1DEJP2JyLDedg9b5H+aa\n' + - 'FDZFc7yQ3In/QPtjHImydLt9NwARAQABwsB2BBgBCAAqBYJkq+dvCZBm9Bz6\n' + - 'DvB6DwKbDBYhBPkdSvwnOBuAJaOWAGb0HPoO8HoPAABRUQf+KoF4UXuseLBO\n' + - 'd0PD0+hEcnsYbaPWmPZtJPWusxPl6kt421luymPiThDXwaMVzRrmxkz0dNZ3\n' + - 'bUFYtS24t2BhlXZ6cGFNRjXrA9OV0kLg/kNm1vboQ1GL8qRV9CIjPVEpksQp\n' + - 'tOiYN+X+/2XdPJkaQpITHIFV067qWQSAKIonvOI8OJYOovGRQTInz0VE71Yn\n' + - 'SeiOilKBK+p2RN38jGr0PGWt740KJ6560FzfUwTAQzz9vrkYa+vEhWe+bzOd\n' + - 'YBpxj/BRTGR19DrKlGcFPdTYz5ADxCjBuCxXgoRCbBiWwh+iIstk5qkT8uHK\n' + - 'NQjzDvo3RO1cROQp0zsikladmzGZHQ==\n' + - '=q/e/\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA10lEQVR4AcXBsWnFMBSG0c8/brOD9kgfogHUGQIuAppInSsVAQ2gdbSD64fTXl4hMI/HPWf5fXxf3DDaxkxIlTuEM+FMOFt5MtqG1XvBipGpsp9YMWaskCqWcCacCWfL4+fzwogx8069FyzhTDgTzpavv3oxEVLlFaNtzAhnwplwtvIkpIpV9hMrxsxM7wUrHxVrtA1LOBPOhLM1pIo12oaVj4rV98JMPj6wRtuwQqpYwplwJpyt3BRjZiZQuUM4E86Es7XsJ1aMTIVUeUXZTyzhTDgTzv4BnGY033BWusUAAAAASUVORK5CYII=' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0xaC6C69c657cF6022fa787B14BDdaA22936B56D65', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA2UlEQVR4AcXBQWoEIRBA0Z+ikOwNDHirbARPKDiLvkzOIATaC4iQbGt6ITSzqPc+np8/fxhpVazzcfCOr99vrK4FS3AmOBOcKRddCy9GwQoxszNHw+rKluBMcCY407QqO10L1hyNO9Kq7AjOBGeCMz0fB9YcjZ20KjtdC1bXghVixhKcCc4EZzpH446uhXfM0bAEZ4IzwZmGmLHmaOyEmNmZo7ETYsYSnAnOBGfKRVoVq2vBmqNxR1oV6+SV4ExwJjhTLroWdkLM7MzRsLoWrMCBJTgTnAnO/gGd1jrTKk/8EAAAAABJRU5ErkJggg==' + 'wsBzBAEBCAAnBYJkrksbCZA3GHnYNke0AhYhBNp+D95LDfs4yU03LzcYedg2\n' + + 'R7QCAACRdAf9ELAnCLXfBiAVdbgwj81xr+w9Yzw2wXLLrPLfYY7EXfyChLzQ\n' + + 'rr9XBDdWMgtzEU1diSPMbLDh1METR7n71EjG0AoeX5A2pkHI7R1vIxXUJR3G\n' + + 'fzHENsfGaKLnhrL1wLjBQACzEsIqPrHl9RItdtKEs9izLmc+wV0GFJ5OjbAs\n' + + 'ty/1Q36nnMB7sQ7Ytb9Op+q0TtZPZ7jF9CjX8KGav3P1xDQex9nfsXiDHlLK\n' + + 'MqDePaaMO6RJUWAP2xTo2k1DDJQ2dpUhs9XyjMlvFhVbIcT1/lVRCPC8V3C8\n' + + 'fUKhUejvOjNFxf0QuR+E4xs+Q3zvR1+fXdJBxbH2Fp3kOTN1N9/LEw==\n' + + '=sLLC\n' + + '-----END PGP SIGNATURE-----\n', + spaceImage: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + spaceName: 'statutory_amber_roadrunner', + isPublic: true, + spaceDescription: 'continued_bronze_pigeon', + spaceCreator: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', + spaceId: + 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', + scheduleAt: '2023-07-12T06:51:32.000Z', + scheduleEnd: '2023-07-12T07:41:32.000Z', + status: 'PENDING', }, - { - wallet: 'eip155:0xEf532414907E8c631307c0d501cDe6D1694bAF5e', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBobHDMBBF0ZsdjftIDeGuIkzIaGsQC1MNQkZirsLcnaQCk3yqBOzMH4N3zu11f38I+GPiinacRAwxQ8wQS/zo1flSGqNenUgujVGvziiXxsgQM8QMscSPXBqjXp1RLo1Ir84ol0bEEDPEDLHkj4lI51uvzn/4YyJiiBlihlhqx0lkZ2U0Pxci+7YyasdJxBAzxAyx1KsT8W3lil6diCFmiBlit9f9/SHQq3NFLo2IIWaIGWKpVyeybyuj+bkQ2beV0VwXIoaYIWaI/QH8GTSs76EUEQAAAABJRU5ErkJggg==' + msg: { + fromCAIP10: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', + toCAIP10: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', + fromDID: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', + toDID: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', + messageContent: "Gm gm! It's me... Mario", + messageType: 'Text', + signature: + '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJkWKQWCZB7dzg7q3axjBYhBJFuYslzDGbuE+3FMnt3ODur\n' + + 'drGMAAAjtAf/TXjtm2qb6aSikFPKYXm0Ekws+65fisJGf7T48MYkkfcD4t2e\n' + + 'HXd9LtohzGhcztbOQfAND3yME1GWuMBIksq9rlyEA0ezwsGzCJVhBnkAHBe3\n' + + '+1v4/mNSMmInU8y6sOiLiOcW7ameJvZvDdPDJ0YHhc9dKDCIh1UAZEPAgx+z\n' + + 'Wc0DM6pW8bT70dfgnuW2LlLGF5Z23Z1vbHmeszt78+xYY3ez/hoMHXUIE25z\n' + + 'Wrnt75nasBBahtJ0mwH10ATnsQNE9hTi6XPGYxRSNDM9nyRxTQUpjhNmGS/+\n' + + '7oFyq8xTcRSaL7d3h8URp9hgFWher5ZZDyMV0jvk+HPguUX54g6Kgw==\n' + + '=dcRD\n' + + '-----END PGP SIGNATURE-----\n', + timestamp: 1683530775648, + sigType: 'pgp', + encType: 'pgp', + encryptedSecret: + '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMA9aU+JGZVRn/AQgA1pIJHyeJinU21r6At5S5ZaWeN0OEKVB2TjpqZ0IW\n' + + 'lHLKQrQ8k3M16bN+Vf0P+DzDVOL84QRkBD56qSNVHOOCox5wcQeR01CczenV\n' + + 'LUVvVjBzR2hj7Sdw+Q+M//rgeZPPUDbNyiVmGijelhwDqWd7IOoZY26AGXlm\n' + + '7YQiElvHN2HcYXaTlLAOy36BcccwHu3Tn06F77ZXaf8FnGMWOUy7wh1/jugg\n' + + 'D17jUZGLYbmw+u5l9BOfljbw2pb4vtjWht0I1b4GYlKb+bYg/NY0UNsq7mSh\n' + + 'dGAmOhy5tC2NMjLRRLfD2qasxHoHN50onlB6HcYLl0RCf31ebOgO6rMhUnxt\n' + + '9cHATAMLWLG2xubrYAEH/2tVeq2j7nJALGSFxjJPboOY57aiFrhXNQ/e/oXH\n' + + '//TNJgGWx4Ta++OuF2Oexbh9DIZhl6DWld9adXDDtBS/fEyjNsYqwoYlNEJN\n' + + 'kLvSmokNNrE4MKC1A0GkhSh2MGQDNk42GSgz1tep8XSVc98MHqfNXCHVb5Oa\n' + + 'OBeWKLFyElT3+KuZxSkCsnoO5YjuCGbXPyG06tXMHXMTncpj1ri+vpjUSnhD\n' + + 'wn3o0zpNWu0GaWXIgTqj2ZouVwV2S1+wAJQjE8uI1JvBiMhA+X63/GCcApBu\n' + + 'C7rN0Cs5NGXCn9VWp8i1SCp2NuZ38POABwsXUUkjpF24txyUDX8dbXlkzpao\n' + + 'g93SQAElYYmyKbGp1TKhAZl2u40mgf2yCYDv2DLRfAKMJDLvmjXoUGEg2UYO\n' + + '11w6LD0pIykdKJmFtRls/uMnlcoBgDA=\n' + + '=kzUH\n' + + '-----END PGP MESSAGE-----\n', + link: 'bafyreib34jgnpp573rwquejcq5avxvydis7fbykat6dd5z7uazobucoumm', }, - { - wallet: 'eip155:0x2F5f27B523C8888eA79b7FA80a9CbA6b6980784c', - publicKey: null, - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW3DQAxA0W9CExjIDhogfboDCw9gICvcHmldcIAMoYLgJJ5CKzgto4KA4ILvXT5+Pl8kwydZqJHt60bl+ryRDZ9koUYmNBOaCc0u31+/L04INSrDJ2cIzYRmQrMl1Dhj+KQSapwhNBOaCc0WDvZ1o+ROZV83KtfnjUxoJjQTmi0c3B/OO+4PpxLKP0IzoZnQbBk+yUKNyvBJJdSoDJ9kQjOhmdBsCTWy4ZNKqFEZPqmEGpnQTGgmNFs4CDWy4ZN3hBoVoZnQTGj2BxvbMvuaMCXUAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkq+dvCZBm9Bz6DvB6DxYhBPkdSvwnOBuAJaOWAGb0HPoO\n' + - '8HoPAAD5ywf/cvaGM0DzcB22Q2FMzUZG4/ZmkN4OknvSj0d4hB/sPUIb9176\n' + - 'z+niFMjWZNFpIj8s36f16oMEZZ+Eleu9t6sECBxRDvO8pEwyByCXSmz8e/SH\n' + - 'Y659cvg5/A3bSe0FqR0VTI1o+Uz2BpnXG/P38C6D46btaIaJcr4cIh88wQ9J\n' + - 'lr05hOE7w/7Uo5OwyXala0NfB+8S4LIfpC2OlPOhyHQEJd2+WoFKb/6dO28D\n' + - 'TLuvgYJXJfc4R3ElcgFfm1N9ylG0Pt1F3c0C/k9bNokR2PVXgX2XSTQsx1rD\n' + - 'MCY/ePr93INyNZuTPcPlK87X6OTa2/gEW161vup2Xn2Did9HtL76Qw==\n' + - '=EkOP\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'intellectual_green_bat', - isPublic: true, - spaceDescription: 'sad_purple_pinniped', - spaceCreator: 'eip155:0xd1ab5Af3Be78bB1492099CE568761F0e706352a0', - spaceId: 'spaces:9dab226c7920fe06154d76f78dfe1187bdc4fda712cdd9a8b37cc6a99741a63b', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'ENDED' -} + }, +]; ``` +| Parameter | Type | Description | +| ---------------- | -------------- | ------------------------------------------------------------------ | +| msg | `IMessageIPFS` | message object | +| did | `string` | user DID | +| wallets | `string` | user wallets | +| profilePicture | `string` | user profile picture | +| publicKey | `string` | user public key | +| about | `string` | user description | +| threadhash | `string` | cid from the latest message sent on this conversation | +| intent | `string` | addresses concatenated from the users who have approved the intent | +| intentSentBy | `string` | address of the user who sent the intent | +| intentTimestamp | `number` | timestamp of the intent | +| combinedDID | `string` | concatenated addresses of the members of this space | +| cid | `string` | content identifier on IPFS | +| spaceId | `string` | space identifier | +| spaceInformation | `SpaceDTO` | all space information | + </details> --- -### **To approve a space request** +## PushChat Class + +### **Initialize** ```typescript -const response = await PushAPI.space.approve({ - status: 'Approved', - account: '0x18C0Ab0809589c423Ac9eb42897258757b6b3d3d', - senderAddress: '0x873a538254f8162377296326BB3eDDbA7d00F8E9', // spaceId - env: 'staging', -}); +// Initialize PushAPI class instance +const userAlice = await PushAPI.initialize(signer, { + env: ENV.LOCAL, + streamOptions: { + listen: [STREAM.PROFILE, STREAM.ENCRYPTION, ...Object.values(STREAM)], + filter: { + channels: ['Channel1', 'Channel2'], + chats: ['Chat1', 'Chat2'] + }, + connection: { + auto: true, + retries: 3 + }, + raw: true, + enabled: true + }, + }); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| status | 'Approved' | 'Approved' | flag for approving and rejecting space request, supports only approving for now| -| senderAddress_ | string | - | space request sender's address or spaceId of a space | -| signer\* | - | - | signer object | -| pgpPrivateKey | string | null | mandatory for users having pgp keys| -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| -<details> - <summary><b>Expected response (approve space request for a spaceId)</b></summary> -```typescript -// PushAPI_space_approve | Response - 204 OK -``` +## Parameters + +| Param | Type | Default | Remarks | +| --------------------------------------- | ------------------------------------------------- | ------------- | -------------------------------------------------------------------------------------- | +| `signer` | `SignerType` | - | EthersV5 or Viem Signer. | +| `options` \* | `PushAPIInitializeProps` | - | Optional configuration properties for initializing the PushAPI. | +| `options.env` \* | `ENV` | `staging` | API env - 'prod', 'staging', 'dev'. | +| `options.progressHook`\* | `(progress: ProgressHookType) => void` | - | A callback function to receive progress updates during initialization. | +| `options.account` \* | `string` | - | The account to associate with the PushAPI. If not provided, it is derived from signer. | +| `options.version` \* | `string` | `ENC_TYPE_V3` | The encryption version to use for the PushAPI. | +| `options.versionMeta` \* | `{ NFTPGP_V1 ?: password: string }` | - | Metadata related to the encryption version, including a password if needed. | +| `options.autoUpgrade` \* | `boolean` | `true` | If `true`, upgrades encryption keys to the latest encryption version. | +| `options.origin` \* | `string` | - | Specify origin or source while creating a Push Profile. | +| `options.streamOptions` \* | `PushStreamInitializeProps` | - | Configuration options for the stream. | +| `options.streamOptions.listen` \* | `STREAM[]` | - | Specifies which streams to listen to. | +| `options.streamOptions.filter` \* | `{ channels?: string[]; chats?: string[]; }` | - | Specifies which channels or chats to filter for. | +| `options.streamOptions.connection` \* | `{ auto?: boolean; retries?: number; }` | - | Connection settings, including auto-connect and number of retries. | +| `options.streamOptions.raw` \* | `boolean` | - | If set to `true`, will provide raw stream data. | +| `options.streamOptions.enabled` \* | `boolean` | - | Specifies if the stream is enabled or not. | + + + + +\* - Optional + +## STREAM Options + +| Option | Value | +|-----------------------|------------------------| +| `PROFILE` | `STREAM.PROFILE` | +| `ENCRYPTION` | `STREAM.ENCRYPTION` | +| `NOTIF` | `STREAM.NOTIF` | +| `NOTIF_OPS` | `STREAM.NOTIF_OPS` | +| `CHAT` | `STREAM.CHAT` | +| `CHAT_OPS` | `STREAM.CHAT_OPS` | -</details> --- -### **To add listeners to space** +### **Fetch Info** ```typescript -const response = await PushAPI.space.addListeners({ - spaceId, - listeners: [ - `eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F`, - `eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45`, - ], - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, -}); +// Fetch Info +const aliceInfo = await userAlice.info(); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| listeners | Array | - | new listeners that needs to be added to the space. Don't add listeners which are already part of space | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| - <details> - <summary><b>Expected response (add Listeners to space)</b></summary> + + <summary><b>Expected response</b></summary> ```typescript -// PushAPI_space_add_listeners | Response - 200 OK { - members: [{ - wallet: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGSs51IBCAC+y8oXbU2YvfI7Z4xnSRfcPecRR+nO/XVLDbt30mbn1NU8\n' + - 'wHSXcuHLJTuU9yJy1t9AMB2SY8n/YWMFbeNICF0OQVINkvFS+8Ec/F42IIlb\n' + - 'StUY8rLS9pxTQoI3k1LnQKNL1krGiEuDl2ZT3l304aPGkF1sowu5w6xnzl/o\n' + - 'nb6cgc48jVqIgqoVUCnEoxc3GKdSORm35nl0RBDasFdFPJctnpg2n7hLofU1\n' + - 'RGOIzf/cITY7AE3nta0cqaFgNsO4rO0fXRwgDBAu66CtBG4Px2X8hT7IYMum\n' + - 'XJtCis3KvrmQAOhWrbAwmWjHbkSDSYigd39rmlht21GKf0/kfoILBgRfABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKznUgQLCQcICZDTsTetOyJa2gMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBHGBWhlF6JChmgQO7tOxN607IlraAADq/Af/XWeAagX5+JCX\n' + - 'ChzadMaUtI6m2F7nT8sJcJep/a0Ldyz6kPmP9k6kmWO+QXJwl4FrP3e7HPer\n' + - 'SjTeIWm0FJ2a+pRtF+lWk7xjIWJuZxbx79nOk98arde75fT+bebne1V0raUM\n' + - 'gXPQIc60++okAPif6vJVLAaSMNbCkv8+Lsy0mJqsjY3b9iMVKWHKb8XVvTuN\n' + - 'pobxVV4dLq53lrdNDIiwAWTlbxyuKLSEF4f+hIPJX3PAhquORinOubclUwTM\n' + - '+kEmE6VI3pW4VL1VRi10cDI6ruEVwqOwQyYcp9gSDKXFR6ZXz7t0hjUUhl+3\n' + - 'z6T7yqAjExW1O4tETVSbt3jg6DjaAM7ATQRkrOdSAQgArRRrLZees3xCYyBO\n' + - '9WDzy7XCM2FxmaIJs/ibWwTtD1ZVoc9NKeOx07FYwGiYjigY6FxxJHdr20IQ\n' + - '3xieIyBLZM2XAIXrsxq4M9GLG8R6nhd35BenjcvSGiZH1Rq0aXtFt9Fd7gc6\n' + - 'E8XpMcHPH8KEnf66sPz18vrVCdstVU4Qj2ZjH25ilfeGdMj2HHfDxVN8sRhl\n' + - 'AXAcwblQ+IVXGjuKw19T4zN874bcAaOmXfzxu3+2PtxVSR5uV03x1ln3ji+b\n' + - '+GF8atJMMHCqE0FC/dEciS+BWSQtv0D93XWjzExJeyhd7Z+I3BG8JPuJT5Yj\n' + - '4PxktEgwUxQc83JFFwED9knzyQARAQABwsB2BBgBCAAqBYJkrOdSCZDTsTet\n' + - 'OyJa2gKbDBYhBHGBWhlF6JChmgQO7tOxN607IlraAABLdggAhe1KLjtHTsUI\n' + - 'SR0K25EJ+9gXC7wmebve9wNZL22/Ud9hnyS77/VUmMNBgdPyhm/9ITMhVtTt\n' + - 'rRNo1AzsVKDn3/dW1kc+nSribOufxzMoBM7Bm918Zt/0/7wCegz0bp3EAoQ8\n' + - 'KEa2KPY9lSh2WtEDoA87D8JB1xwIfcR98vg5/AZ7VdtE88foSqXAm+6F85hz\n' + - 'nAASNBO9CCDvUofR28b4exT/aWX0qZxLAukgH7fnYC3KPVv+9ug6mdyJPsOZ\n' + - 'LFjF327UKLrBuQ6VRlfKF+XULJbtNPxckgwO1V/oxycq/M67acGoXgc2MgP/\n' + - '2qOkbiQC0ZxcA+Ze5TNNhuGWKv6d9g==\n' + - '=S9Ba\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1UlEQVR4AcXBQU1FUQxF0f2bZ6gaIOkAC4yxUCRQHyRoqIo6wcJnesLgEgJJ17p9vDzeEe9vd046nZOo4eT59YYylhnLjGW3p8+HOwedzl9EDSfGMmOZsezim05HRQ2q0zmJGlSno6IGZSwzlhnLrk5HRQ2q01FRw0mno6IG1ekoY5mxzFh2RQ2q01FRw29EDarTUVGDMpYZy4xlV6ejogbV6aio4aTTUVGD6nSUscxYZiy7+KbT+U+dzomxzFhmLLv4QdSgnl9vHNWgOp0TY5mxzFj2BfKPPQUA5ipXAAAAAElFTkSuQmCC' - }], - pendingMembers: [{ - wallet: 'eip155:0x4d2eFB18383a48aCe19a198ae5228BB4bf854cec', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9UlEQVR4AcXBoZHDMBCG0S87ZqEmooaiLmJJsNtwIyFuwzhERZgKmoqkhxz9HaCbmwP73u159w8iN0fVVFC5OT01FVRujqqpoIxgRjAj2JCbo6b1QE3LiDrpeywjF+vBRXOUEcwIZgQb+MW5zaiaCl3NUdN60GMEM4IZwYaaChfNUdN6cNGcnmk9UOc2o2oqKCOYEcwINuTmqJoKF835i3ObUTUVVG6OMoIZwYxgt+fdP4jHMqJe+xuVm9NTU0E9lhH12t8oI5gRzAg28OXcZlTeuKip0JObo06+7AVlBDOCGcFuz7t/6MjN+Y+aCj1GMCOYEewHE5pCbf3G8WQAAAAASUVORK5CYII=' - }, - { - wallet: 'eip155:0x8E50Bfb57f803814c242c5a25890f5F0c13304fF', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsWkDQRCG0W+Gy53pkgVVsiXYFVx2rsANiCtEmQoxbCHmYBNd6gLW6aBgjDDmf89eXr8GiW6VqIxGplslKqORccQcMUdsWued6Ho/k+lW+Yt13okcMUfMEZt4sM470YUb0XYsZC6nG9HKTsYRc8Qcsel6P5PpVnnGdixEZTQyjpgj5ohNPOhWyZTRyHSrRN0qURmNyBFzxBwx+34rg0QZjahbJVNGI+pWyThijpgjNvGLbpWojEamW+UZjpgj5ojZx/vnINiOhf90Od2IHDFHzBH7AWIQNGL6hyehAAAAAElFTkSuQmCC' - }, - { - wallet: 'eip155:0xaA6E4434D881D2bDEea891AE127313AE5515a06B', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyklEQVR4AcXBsZGDMABE0c8OqQPGZShzCdCCVNZVIhVAYrpQ6g48lMClkgMlBPve9HjtF0bCTJgJszmXykiKgTtyqYwIM2EmzOYUAyO5VO5IMTAizISZMJu/70rrOOmkGLgjl0prXegIM2EmzKbHa79o5FIZSTEwkktlJMVAS5gJM2E282Nd6Dy3QCuXykiKgdb3XRkRZsJMmE375++isS50jpNOioGRXCqtdaFznHSEmTATZjM/nluglUvljucWaOVSaQkzYSbM/gGGCDCC/3c1nwAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xf6106dd699B6e40f1E822c38DDA459F533470b11', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAwUlEQVR4AcXBsU2DMRSF0S9XHoIFIipmIEW2sPQ6pmGEdJa8BYXXsOgYxKF9afzrr+45l++39uSEUGenrcoZwkyYCbPCgVAna6uyE+pkbVV2hJkwE2Yl1MnaqmT364Ps5/eLnfv1QRZzkIU6mTATZsKscCDm4IXYijk4Q5gJM2FWONDeb7yYbLX3G1nMwY4wE2bCrHAg5iALdbYmpwgzYSbMLh+ff0+MhJkwE2Yl5iALdXbaquyEOjttVTJhJsyE2T84uix63kKmNgAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xAF3d4989652a6ED5554b6191c555525977424Cc9', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA3UlEQVR4AcXBsW3DMBCG0c8/tEMmUClkBDVaQAWHIKAZWHAGAxyChZDejbOCkcrDOO3ZxQlGENx7p4/t64Gj58JfpFbxiGAimAg2cOB6uWHNy4TnernxDhFMBBPBBl70XHg2YaVW8fRcsOalYKVWsUQwEUwEGziQWsXqueBJrWL1XPCIYCKYCHb6/vl8YKRW+U89FywRTAQTwQZebOOK53zf8Wzjim/CEsFEMBFs4MD5vmP1XPCktmNt44pHBBPBRLAhtYrVc+HZipXajmcbV6x5mbBSq1gimAgmgv0CTksv6eJNDqkAAAAASUVORK5CYII=' - }, - { - wallet: 'eip155:0x2ccBeEf6e30dF46D0A7Ee79Bc66FBF3beA7EeA5A', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBIW6AMBiG4XdfmnAYboLlCE3NFBLX4JB40hMsWM4x08OgNvsXUbMs//N8fH59/2DksfCfthqxhDPhTDgLvGw1Yq3nhLWnm571nLD2dNMjnAlnwlnIY8HaasQajplGpWs4ZhqVRh4LlnAmnAln4VkuGinSs54TXcdMz7NcWMKZcCachT3dWHksWM9yYQ3HTM+zXFj5oLGlG0s4E86Es8DLViONFLEyhZ493TQqXcKZcCacCWfCmXAmnAVe8lj4izwWerYasYQz4Uw4+wXktDHpzVVJlwAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F', - publicKey: null, - isSpeaker: false, - image: null - }, - { - wallet: 'eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45', - publicKey: null, - isSpeaker: false, - image: null - }, - { - wallet: 'eip155:0xa145b34443e28C8f718Cd0691Dc41A81E0d0A857', - publicKey: null, - isSpeaker: false, - image: null - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkrOdUCZDTsTetOyJa2hYhBHGBWhlF6JChmgQO7tOxN607\n' + - 'IlraAAAqUQf9FvAtNouG7+2YSyyx7eiHRJZroDPFohH/F2xyc+oJkgh40p2y\n' + - 'hyKw+DSp0FA+IiT95/y8RbGDUrNFz+/kdMfZWCEYFim3Cy+c5k1/YNc8qxx6\n' + - 'VLwef+2YZepC1pSS9K0zbu04uVPWrNmDa5lHXqzTx/mOxWlxLD0NfpI60csE\n' + - 'iQx57duy2gMeW9MwOKSFjOSnWHKy7AySm/vBwZ9Rj4gnOhsvwbAfLprQQf4G\n' + - 'cUaxG/HOb0c/8Ugews0Z1uDJFmGKjT5R5CR63vPo5qDGQwWkm+LYpshCIV+K\n' + - 'ofLepDqQRuEFa7VyUlDOvMcF15LtlvAhwhkIVHvTGjXZC91e8/IUsQ==\n' + - '=UpR2\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'weird_moccasin_alligator', - isPublic: true, - spaceDescription: 'equivalent_blue_armadillo', - spaceCreator: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', - spaceId: 'spaces:d37c4e303a2ff194e546d3af94353ec829324a578ebffbeadebd1ba91ab88548', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING' + did: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', + wallets: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTu6YUBCACa7JaMqfhAnD/9ynE5Rhi8KNQ1tfdQe0ay/9jXX2naZIA+\n' + + '6WCi1uNcB2TTLfMuzsEl4u/26LTgtkr51snRt2QKgEqi5dXqbRD76wiRLd4h\n' + + 'ktBb4WB28o+BWOHYYJQq8he+zu3mQWjKLb1e9DyS0cTzwPwWVKce9IsG3NOi\n' + + 'eM7O5Kg5cU3qHXR+frF25peCBrzNXH+xuuTJPsX85h9dSz/u6dWXhk2LsX3s\n' + + 'cmX5mFcFErnGvUBddDGZc11q+WzZAtENPCxQrNjpkMtzCj9UMwgsJdzBghZZ\n' + + 'ZouGTG2uhfmIj3/KHOdwx/KGpTgC1iMVOb78kw9LmaxL6fGy4x9uvvI3ABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO7phQQLCQcICZABDloJB8hpcgMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBMga3B8GDU79nd/0mAEOWgkHyGlyAAAbHAf/bJMPIyvNZNjO\n' + + 'JK2xA1hYpzIGdbi3jMego6GXrmet3qY50zMKDccB2Ot399y/nmWMVEyfKYaP\n' + + '7N+mJbeAqIZ8TAHtpw++k/h8/hXoxb9iPsQyWYossuG499XyHnk+KEd4g0Wf\n' + + 'mqPk/XJB3xLLgW820jOsRRbWLyYKJEdh1Q+GIM+D6oIJ9ZmyRPv25u6yCF2P\n' + + '2IQZErWeYD/LxqMDw+uHdRZJRiyFy/Y7A43clejN+p3my8oktXh2N4+tEl7i\n' + + 'Hwxc5z9AOffuEyUerm0Rjwdn8rG8po7AfuXwmTiW1Sdc9TdJtAK/n6e9EFHV\n' + + 'gHzArwyaydHHy80Wqa+UF591NkPi387ATQRk7umFAQgAs0ao+EFoKJirGHfI\n' + + '69vZg+eAAUUKG657BzNzTAF2r5Y+a61jdcCAL+DXBcfks+H0dqG36zjOZTCJ\n' + + 'NirABp5RRPFty2VvUtOyezuKX/MBVg3st3t/yE3SncVaWMblAv3iegviNNpH\n' + + 'cFKqpHoVBWDNdhFHNsKTjpJcq3BVohy2Dxh8Di8N/1+gEPxADvIuH9MQ8MJk\n' + + '6lB9XYXBmmqtlQ3sB916mvusUIl8Zxw1C76yY0PAXz055zJMiL1vwo5gKDiV\n' + + 'iKyzry3wq7upPGJyeTKu7uUMifTPhJtyYvon2TIik5DIgHpqKziirCrolA+s\n' + + '7LhnFbawqDKleEdyCcL5mFCzXQARAQABwsB2BBgBCAAqBYJk7umFCZABDloJ\n' + + 'B8hpcgKbDBYhBMga3B8GDU79nd/0mAEOWgkHyGlyAABIqQgAmK9ijEEvtWTm\n' + + '7/mhkuDEtfPfcMexfkaCcGL4SdZqVz/h+eIL8+4EbI9uq+YTzcjtX8FAEQta\n' + + 'KWFACNEOPmSy6Sb9bDoNZUVpDaZzNNtqIK9Brt4zjJLEsDfmkuW3S/SgIYBQ\n' + + 'yTkuNmmAf8dr7L4fG0JlxPyGaL1/w9UDAr7xdU7WcHuyPc0edDGeE7NwaGWp\n' + + 'uBipXFw8AkikV3fCTDuOi3uhkIzZ5zlGCshD7m0aDSABwr4hbFzLFBDSrsiW\n' + + 'GKhWGYgf5Vx8qzlwXYYnoW/rn3UXWpeTXjq46ZNaxjHJ4VxGMyn/tHZOEjDE\n' + + 'vHapLIAgGyw2b+s+zZSqsXaMkH8WOw==\n' + + '=gPzx\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + encryptedPrivateKey: '{"ciphertext":"4f1243e1ffa76180f46ade2eb093867750c6bf72e8d6c71c7c0edca176c2f9fb32c603bb5e52d933730e0350292431b6e5287b8201f60ce9151b6a141bde98cdc3d9e5df8f84e00e5e4173bdf28b66e9590db10195fbd41ed241a65ab84fb5da251f613376bf78efe1af64613dd54fb05dced7cf8de0907d61489712ad42f06b5c775d97d15dee09b1c58cd79f596674e403353bc7e03297aa0d3fdaecac573c962409622ff8b1335b6fbb661bd2d5f5a076d9079f857849ba917662b40151041eca71385844160fc603c4d1beefbf71b26ac8968de52d6bb534ef6d6e2ea987170059d7d881dc684d28b5b2817804fba3b659e3ec0e802583e581b9f75d2f7e69e428cba91e62719e9ca6697588389db89b982370d23952120c0f972ab4b3a0da888d52b5055c60785d276152e43929df532bc7d5d68c6bc3cfdd1ca780df346113999a19d8e4a96c02f149d1ee4cde802277081ef339153872c00c9e9ddfe3ba8da8c68c0565752fea32258087e66aab37397a27b0228b5ed1aeb09a93b80778fd7f949409106c4cd82ff550aafb9d7bdce8727a76882f59ef2c54a137e51f04b6c27a0b1b92cd781dafb489a5e8203232669f5416454cc9cfe8c5b0fd8abc19d9ef16285a8da0aca2ed747adef7b49b8215790266d9c4791c250b0580e89c6429d10a1bcd45cf016a7ae30e1db948147d992722a7191e31852e6fd3c3679d868f34ebbe65f255be4b90dd64ceb52eaeee7d3356683b7fd511729493c887289ddb0f00c65ca2a95114f0e37d3b73d06333e2787c5fa6dd6f6c9e8334ff153dd63e30c81247efd497cf2c038843d8653edf23822eae07dd19d0be26a921673185bcf016533fdb59150ff46096419e6a6aeb1bd4293fc8146848d715d43afd04aa40f2b5ae9d058671677aad2413952a20b5214e18bbf3b4b033d936d673a0302967de3f74b05b74bc6c89f30ddeaab1bf6c567fcee355797b6cba17c3fcc8955bdf096e2dda2577b3374089d8c9d287552e5658c91e812bd0b8b63482c8de98fde216dd557eb34bafca2f8e73dc4582fa36332e8869f2717519921605915d8e1c75a37295e198ec0af75926d89a6832456304474a10c567334998226d9b6f709ebc216fb067d958e78a622040c91f46af202273d0b40307fb34cba5a6a57fbb196ac6e88c16d527b9bdb04b12fa7ed0bc771692712ccd146c41890b5caddbbb13b8ba77e632b2d7597256fb576ce87d2aff35a0e953b8227a5dcbf30f7d189ca7f77f6f8b2c4eb2752199a7a485ab52a6b65b6edd6cf65caaeb6f65544cc74c2fb3431fa484fb69adbda08d2402da953f20425832b6a2d712d56a5cc34095f25fb9524a478a71d387b7dea45b4bd41e79c61dceca332898dfeecf83999ed4fad892e2ede714b93f3969ad140f38bfa95d321ae5ef089cf0ce435d59f8b6611c0fd014c67ed38646f0771f1a74c1f950ee0900d883aca3ec4efbb2f7737e717007ae757d874573d4d70c9d7e38f8ff30a29b983036e684c4eaf35a7c03ed32a8e3fc62f0863c56830127a5f3c0e905a93e7466a4f43f0793cb6752b9be8d03d7be26170f694ecbb200f611bbf1dac4b6ec085deb8c3d8ee188d8c9c8c17ca720c0f0dee4d00e5866b5443b6af6e69ca64b8eb5a8f5fa1e1d27bfacbf1b0ae11241215358f5045b0d1a73d1b15dbd904709340c1e2b42a4ef78f76b8f901d6337849cff1052f06a8919255b596fb36d2fdf789fdf611813d20729c26d517dde6f11a3f6045ec5158652e128cf7c483a0fb8ab772cb5cdb56e42e6bf8c863f173307c3e053168e54e9e65bcacbb144413ff76d08a94929e6cdde2c5944246a4b344f3ca0ada3b403429750bdce76f04668b05ed79e9119f00901e7f7b4f1eea8a1b5b0186e3ed41277040a257601b0f3917db595f3f1808d92071a4e9521a251e9c5a66f2c8a57511f61b9fd88df77330aeb4bc15c043814b33610d60f6d0a13fd7977efaa1843913f6d3a79bc88020406c9979163684efe7b7ade9613221d06b52cd96abd31b77a707748d52e6e16c8c90821f29359b35307c10dafce5f35c0ff9802c23aef19f0a95b49a317cd6207002a5a9b822b4c056c4cbf9b27045dda8325d93060f358bb837f00954a6e281d1bdd1817a7cce8ed4a801f9164d32c52739c1ac650109868664be1fabab47c675222dc9ff9d75f9fb49531c832264aa5b55998675975f59e34829ce90b00092bd77e46328a6459d5c967d905b8e976611b839925ad742500231fa86cb5f7e6f39cb1e2e36b81c55269ea0f5fdcba5c8c0e38a899540d52be49c83efae5243998b926f029dc2980d4fdb1c125db409d015e0b36bc02272da1c688ee1f61d23cbde585064ab1e2164d0ca529774ec7797407ba5d988c58853e74a124a64dc24d0289b6a599354faf64790177c3032f5d660d7b76dfbf1c03388a7c75b2309c509c6a92144e124c8bd188274bc844e8f0aa7b5a06e79ad5776b5a62003b89aef194dcc03cd3c1b1f3ea541805cfc4e18aa159f9b5395185b573538c9bab16876dff91f365d16dcc56b339b01b86882ef8e52c51edd9c5b2f8a35713ed6eb43036e09f64f6e59ab417958faff974b6705400b341439fef4cba371c601927da7e0a8f23e1c6d3e070a19c2216da85f159d60303ab1321e479f4c371372845cef03daa7d2776c18face6cfa2ff9eed26f9f0a353a0f1c9a99b2556dccc1212fcb5c2078a3b0e58a7f3f7b3f346d624435ef94c95d40dc726d2e7400ae405e89473a934e7646124e34473dfe17f7f9cf481aa059ef422508ffe67f9b9276084973db0683269a046c1a0aafa7ab075b28008cbfb862b7e30c8b2afa1c2923d914b3d2469266e8e0182274a3d8d89642723820e61aa2d97a9370789ec4e89ebee05b6c0bef10778caf2a34c2d7622dde5fa64b012bea6205127c3c845229ef553f013b73823dc6631078fc628532e3e518bdc790ab8460078dedf0c5cb00492136813e2b91679bba82f3cf95169751933bee4358f84154014dbcc1de1a30613218039ebb2444429380fd283d3b60bd5d5b470e861f6ecc751c22aa467168512a0ef45755e6b59a7be591bd3b08fde874b166ccfbbedba10a0956d2d18cbda515341c2112d6094a746e9f562db6543e5bde2c4d4f7c06b7550400d66f7242a14f34cd8a7374372f0eea49a49b72909fc11ff81ea54a1e2c07225cdee856383a657b0f13c14b00ae3b7b2a32a22beaab8cfd18641dbfa82619fdcdddd3339e9423e71c487305e8aa932b694e94c37c7e418e4014c8bb264f47e8283e216eeeabf0fbdd2f5eb8d0ea979738d4f18b7bf72d7711f5d22653f217c7305314ec2c47a0ecbf1dc8f9bc1379ae38e2a04e736a1171b947609bb66f8d352ce57230d709f196953471c5504c7f9f40ed2f64bf3bd04bd57521a364ea03b5f0603cceec7851738d97c3fd73c16547d4d143b009a79832a1ed244937dce09edf2d5e32ae52ab0331c449325dce9e5e8ed1563c967a5f92031f4275e3179274ef3e0752ac01caf8a20aabb23d584d4d6607833f95cfc92832d936c37bb8b37222aa842f48944d06b37434c8dce5f19b450a7d1bd568672ef2c8eaa2afb7cff404b33377a61061f56b01849feb918521a7d63cfbe12466aedc7159c577f213f2c157586b8719164cd7108edfa9211287b43aadbad997bc62f8169eec4a6e02aeb535f670878e6af538b5281da04470d318f893102613977390a434e0557302a68ce42e532d350446d4d813b84c07b42bf22fbe4889096ec6303574c95040d8dcfed1b9bd26782c5033d7d1a491fece156cbc19a705204ed38a547e00a09b73bc7a702ef9c2e659171d1daab63958268148aba59766bc7a4ffb68c1ae047d1f0c5fb45fbacd07079f72af301c6aa00eebc0662c6792fc707d388b339d4f45afbf576bacf8730ec3e0f1e9dc0f9a6d58fd146b2293aed8d110da24336f9a4c01ae12c03ce214c6502f5fbc5224dd8b8b2e4edf2af16b811e5c8595fa76cafe34ba66199caaed48b5dfd5ae74a3e6b6d51a09c70afc30ebc0f40d51a15f1a8c2c41ec482eddf14bed3fd11a9e2aa4446268af25b49e429e2528d5df57797f6f3cd431eb5ded8f830c85cecde8012c31500ce9363903739a6759704fa87bfef984ed0285c8c0a5bf2f0985b1b511eb4145e4b27e2df6aa7b5c7a913b76b1ca869151b75c0717389b3d186f4e4637a5ceba3cef64809c3a06551a6a46be31af61c0ef78afb057f6cc625647dc04dcd74eb97f7aee0f5640e24b7662c799013efb83c80ec2851acda7c6328de789ae99ce296494225bd169e49c9a12dc7e281778f7fe275e72571cd5a3608733998d2f6b96c1d26c25223153fc5afc2f6e3d72f57fbcb2d087d718d3b6703b286f1e340c23cd3bc715797edf3ce6d5169bcf783ac9686233cc0358725143008b25bfbd329e1c30654e4b4c9461239d41ae77f706e64e5e60ce6de83becfd056f2678f17474ab9f4976b2d7d5d014d78f716d7d4edbf6ce4ed44ed677274d6b9b6e4bf4946dfd1ed8b821c81957b4bf5cd534ed6ca84dadd9d6380513dc6406b32dcd5c1bfa468a79e88a56656e71aed0c6675540e1617a31e1c122295427590e83b63e8da58a6c5c21a15703994bdc2b90d399b62679a4269224257f3ead5a2dd0980e6f5a45c5a9392929cc4743e106c7335136c9f8a3a29190462eef908eab02cda97dbcb71dff26b0ef4dae51de293b4cff0ebf37fce1391247c5ccf77dfb64974c4a1e6beeaf82041bb0d653e2e9b612f3442bba8480b86fd7b35514fc056d7429d5fb36199d4a6f632ea615d9acc961082d9d91aca416b57582bcd2f182f5f5be02b3f597c680b2e6b37ee4d133e51d077491cb536d6261808c42684d0912fd7bcc97dacdf32394e7b","salt":"da23dc7dbf23136dabc337a0caa170c0db7e4efec5f5c8a648dff9b7cd7df49f","nonce":"fe0e4ec3d40fb7de21a354bf","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"b43efae4c92a35d9c0b5f6178cb8b8a6642c77d0a9281f61beb9f6e8f7b006a5"}', + verificationProof: 'eip191v2:0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', + msgSent: 0, + maxMsgPersisted: 1000, + profile: { + name: null, + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', + profileVerificationProof: null + }, + origin: null, + name: null, + about: null, + profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', + numMsg: 0, + allowedNumMsg: 1000, + encryptionType: 'eip191-aes256-gcm-hkdf-sha256', + signature: '0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', + sigType: 'eip191v2', + encryptedPassword: null, + nftOwner: null, + linkedListHash: null, + nfts: null } ``` +| Parameter | Type | Remarks | +| ------------------- | -------- | --------------------------------------------------------------- | +| did | `string` | user decentralized identity | +| wallets | `string` | all wallets associated to the did | +| publicKey | `string` | Public PGP key | +| encryptedPrivateKey | `string` | Encrypted PGP Private Key | +| verificationProof | `string` | Verification proof | +| msgSent | `number` | Number of messages sent | +| maxMsgPersisted | `number` | Maximum number of messages that can be persisted | +| profile | `object` | User profile information | +| origin | `string` | Origin information (source of the data) | +| name | `string` | Profile Name ( Deprecated ) | +| about | `string` | Profile Description ( Deprecated ) | +| profilePicture | `string` | Profile Picture ( Deprecated ) | +| numMsg | `number` | Number of messages sent ( Deprecated ) | +| allowedNumMsg | `number` | Maximum number of messages that can be persisted ( Deprecated ) | +| encryptionType | `string` | Type of encryption used | +| signature | `string` | Account signature ( Deprecated ) | +| sigType | `string` | Type of signature ( Dprecated ) | +| encryptedPassword | `null` | Encrypted user password ( Deprecated ) | +| nftOwner | `null` | Owner of NFT ( Deprecated ) | +| linkedListHash | `null` | Deprecated | +| nfts | `null` | Information about owned NFTs( Dprecated ) | + </details> --- -### **To remove listeners from space** +### **Fetch Profile Info** ```typescript -const response = await PushAPI.space.removeListeners({ - spaceId, - listeners: [ - `eip155:0xB12869BD3a0F9109222D67ba71e8b109B46908f9`, - `eip155:0x2E3af36E1aC6EEEA2C0d59E43Be1926aBB9eE0BD`, - ], - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, -}); +// Fetch Push Profile +const aliceProfileInfo = await userAlice.profile.info(); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| listeners | Array | - | existing listeners that needs to be removed from the space. Don't add listeners which are not part of space | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +<details> + + <summary><b>Expected response</b></summary> + +```typescript +{ + name: null, + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', + profileVerificationProof: null +} +``` + +| Param | Type | Remarks | +| ------------------------ | ------------------ | ------------------------- | +| name | `string` or `null` | Profile Name | +| desc | `string` or `null` | Profile Description | +| picture | `string` or `null` | Profile Picture | +| profileVerificationProof | `string` or `null` | Profile VerificationProof | + +</details> + +--- + +### **Update Profile Info** + +```typescript +// Update Push Profile +const updatedProfile = await userAlice.profile.update({ name: updatedName }); +``` + +| Param | Type | Default | Remarks | +| -------------------- | -------- | ------- | ------------------------------------------ | +| `options` | `object` | - | Configuration options for updating profile | +| `options.name` \* | `string` | - | Profile Name | +| `options.desc` \* | `string` | - | Profile Description | +| `options.picture` \* | `string` | - | Profile Picture | + +\* - Optional <details> - <summary><b>Expected response (remove Listeners from space)</b></summary> + + <summary><b>Expected response</b></summary> ```typescript -// PushAPI_space_from_speakers | Response - 200 OK { - members: [{ - wallet: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGSs6YABCADC4ldJKGpZ0Z+JJwA1t/1JWp5+dnR98nr7RHPX8eEGxIhL\n' + - 'gtx5TZmek2BcGzNcg66+GEyC4np9USaCZ4/YC9ZMLw8BQKzhOcd3ZILyGtGV\n' + - 'BijBNwjPIbQcy5/cXVtfKCvf303BDYddPYuJ1xFAh7kpvhcR4a72CSpeyEjM\n' + - 'UndteAVTIxqwdpnXIdqpwu6HrSJ089GpHV+XeaDo4Uhg+iHJsCRJy2VJ5m61\n' + - 'CwGx55f3ror6rAXQd+hEx+keLxYINNJLLvfvE9IGsIbKRFZx+emjXQZusbJp\n' + - 'zXYhJnEeHPLVDjWhzo8Q3/4gvOz8m6a+A9sl49sqodLdxVlXQ7d4CuylABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKzpgAQLCQcICZCaDezdj8j4SwMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAACCLgf/dB412nDRcOxR\n' + - 'dNSj2AYknJ+NKeX38KuksyR6wypnaJWpapmIeZCfFjeoBjuBCPd6unvN/IlZ\n' + - 'zPwl66lO5GKJxDaDd1/infxM/dbtFQSESLXlweRLQ/v1+plsntrBUyvbY4uH\n' + - 'Mh9PImYsLY+zo8P5mpBV5AGAMA6R9qmu3axH/MnKVdB0Ky6C/jP+7lPs/QVT\n' + - 'qsISyyI1E9E6Oivzxmao1axfXLdEvICHb6uD0R4p5SUVqHJX41OwM8BFevhK\n' + - '07Hi+c7NhUWp0sxXEOs6dneJZwerCD3EahutpP1Oyt5T8MZitysn2yJ+s5ks\n' + - 'SZza+x8OmCMcMZfZnIsJNnIUvPboP87ATQRkrOmAAQgAteDgsJJ0ftPD+P15\n' + - 'rKgkLuSCD2iwQgm2k8/ZDaXJBsdm4sJYTt2y0ckx7MRpXgLuIyidOGctqVL6\n' + - '/Rl2Hfl30JQPok5cYmYLENVuFz94MEvgDOo8jacyfPdLGPMWZMLRojyM/Yvs\n' + - 'nhDZ8if3zEstP4h3HcpdT+PWSmsJWjrq57la4vKbfILtKfTBaf8sibm5UuZA\n' + - '5Y/SIPxfVC+ybCPAjo4tpDYP901V+wxXDJ8BlZ4AaVvk20MYMzuAjBna+iwD\n' + - 'f0j4CccEabd2EVtAQQcMCg2yTjOT22Dt0jfpDuohDNaXDhX2ZQlJIdlSLCEI\n' + - 'a3c7g+uU9bnNqt7LHPgMzLYKnwARAQABwsB2BBgBCAAqBYJkrOmACZCaDezd\n' + - 'j8j4SwKbDBYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAAD2vQgAu9+sd4AT5b6c\n' + - 'mWOaQBXz2XVfJXYQFNlBdOF23reycF9r7vDAKSRpeyMSyOfRAi0qdLynQ1dN\n' + - 'MXV/gfO0G9dzFu513P/Y1sZxQi0uLRKL9hMcgEQ8FLo8/PGfVcoLfQASryGj\n' + - 'Z8ybCFqiXocGpt2VkkK4wwgv+ZwZ8M1ubz0Boby6A1/kTYs/6ll+QekpB4ao\n' + - 'kJKw3DWvVNR/xODFfMQcClvzAtqwfxhTZXBMbZ4vAG5m1ExGmA15cGXrAfwV\n' + - 'nR2vOhPYDeZGbBKktM3xfDts75N2NF/TBpvazV2DTKpkLqvVitFHWvSMMpVd\n' + - 'dwk9tEOmBlj2AoYATvQ9kKHRTD27Wg==\n' + - '=IXzf\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBoXHEMBRF0Zs3oqpHNYgJecZdGKYMd5GZRWaCwaohZbiAhP5d8HeC3jkfnz/fvwSTRua+DjJ1nGQ6i0iYCTNhVnjRWUSTRlTHyX90FhlhJsyEWeHFpJG5r4NMHSfRpBF1FpEwE2bCrPDGfR1E29jJPK6DqI6TjDATZsKsTBqZOk6iSa6ORmbSiISZMBNmpbOIHtcXUR0nUWeRmTSi+zqItrETCTNhJswKL7ax82wRTRqZzuLJ2MkIM2EmzApvTBpRZ5GZNKLOIiPMhJkw+wPV2i2sD43hKwAAAABJRU5ErkJggg==' - }], - pendingMembers: [{ - wallet: 'eip155:0xC1469cB7b59d16dC887D4C11faB3E3C0abBeA12C', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsWnFMBSG0e9dBAGDPUs6LeAFNIEb1x5GtRtDei3gBQzZIFtYYEj10t73CkFw8Z/z+Pj+euJs14iXlsodJfd4U7fjGWKGmCEWzjnilUzTsB60nHOk5ZwjniFmiBligTdTt+MlIt52jbRVvKnb8RIRzxAzxAyxx+/nzxMhQ8wQM8RCyT0taancUXJPiyFmiBligTdTt+NNKy/OOdIyrAct2zXiGWKGmCEW0lJ5kUe8tFT+45wjXsk9XloqniFmiBliYVgPvHOOeCX33JGWijesB54hZogZYn8uFTTKoy9pgwAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xccF7a3131E0E73F83Bc457C27494411a57f23248', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9ElEQVR4AcXBIWoEMRSA4X8fw6qayBW9zULVEBFygLqcqMwdhlBCbKjqXSLjY7b2UZEVpbzvu3x8vT5QShhoqUa0Yz9ZSTWiHfuJ5rNDE4wJxgRjl8/v9wdKn43/dLve0QRjgjHB2NZnQ7td72h9NrQSBis+O7Tb9Y7WZ0MTjAnGBGMbv/TZ0EoYaD47VkoYaD43VgRjgjHB2MYTqUa0Yz9ZSTWi9dlYEYwJxgRjlzf38kDx2aGVMNBSjawc+4nms0MrYaAJxgRjgrGNJ1KNaH02VlKNaH02VgRjgjHB2OazQythoKXKn5Qw0Hx2aIIxwZhg7Ae2cUcV4Bl8pAAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0x052aD82D3a7b4DAb5b9BcFED771D28703a6faadf', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBoXFDQQxF0RtlkZsQNjHICKYYV7DFCAW6II2BycfbhklCNR/sTNA75+Pn+/MXIUPMEDPEBifhSVdr0oUnO7UmXXjS1Zp0hpghZogZYoaYIWaIDU5qTbrwpHtfnuyEJ12tyY4hZogZYiM86WpNdl7Hg53wL3bCk84QM8QMscFJeNLVmnS3652dOiZdeLJjiBlihtioNenCky486eqY7IQnO7UmnSFmiBliIzzpak262/XOf7wvT7rX8aALTzpDzBAzxP4AMOQyARcWaToAAAAASUVORK5CYII=' - }, - { - wallet: 'eip155:0x956f73E5a3BF0D19299BF74bD6dc819D7f775eC7', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsYnDMBiG4dc/nsHgHeJWS1x7G6QzqNQUKlUHLn12ONdqNYTBS/ja/xqBCeF7nmFbbydODoVPSjXiGWKGmCE2Pu8vvPT45pOe9xeeIWaIGWLj0Xa8HAo9qUZ6cih0tR3PEDPEDLFhW28nTg4FL9XIO3IoeKlGPEPMEDPEhq+f3xNnWmZ6jrbTMy0zPUfb8QwxQ8wQG6dlxjvajpdq5JLKPzkUvGmZ8QwxQ8wQG4+246Ua8XIovCPViJcpeIaYIWaIDdt6O7kgh0JPqpErDDFDzBD7AzabOPmHFg/aAAAAAElFTkSuQmCC' - }, - { - wallet: 'eip155:0x19da526eD1a57E07D48aa25aDa6cbA7E41FF3129', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyUlEQVR4AcXBsY1CQQxF0cvTFEHuNn4jxB6JJggpw5Mh/UZogmByumBTi2DQahf5nMN2vr1IjvtG1ufgL8Kc7Hm6k4liopgo1i7XB1nsG990uT7IRDFRTBRrfBDmZH0OVsKc3xDFRDFRrPFBn4MszFnpc5CFOSuimCgmih228+1Fctw3vul5upOJYqKYKNaO+0bW5yALc7I+BythTtbnIAtzMlFMFBPFGm/CnP8U5qyIYqKYKNZ40+dgJcxZ6XOwEuZkopgoJor9AIckL2mEiBQrAAAAAElFTkSuQmCC' - }, - { - wallet: 'eip155:0x77059B40Ec974883b98a23eef519b4076D1Cf9F1', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsY0CMRRF0cuTQ6rYaQFiAvdBYMkFkFEAwWYTryxZ2kIcEE8N1MKmH4JJRuw7Z/d7uD0JRu1EuRW2GLUT5VaIhJkwE2a788/XEyNhJsyEWcqtEI3a+aTcCpEwE2bCLI3aia77E9EyT2xxvDyIvmsnEmbCTJgl3izzRDRqJ8qtsGbUzou58KLeiYSZMBNmKbfCf8qtEAkzYSbM0qidTxq1s0aYCTNhlq77E9EyT2yRW2HN8fIgEmbCTJj9AUPBKWCCQlIAAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkrOmCCZCaDezdj8j4SxYhBGZpOFBNtTj1Oqt695oN7N2P\n' + - 'yPhLAAD+iwf/dvaRCTwXKGH6iUe49NpyTHMaD6ZwaLerk+K4Ojehbdoo0mDf\n' + - 'aOu/MR8wfqk49h2436rcMmyeM5avcMgmtGUmIdy/6hCZ6zxR/3E5t/vq5UfO\n' + - '3YFO1VLghR5cTYqR9bMLFkvvCB4P29rnaok2QVKTBZLfyAM4wu1h2DDBESoz\n' + - 'SS+ZtQLPz6/y7gOQobO0zbwBPmy8MpVVu1wxht+sneOMvZX+5al679nQbwNL\n' + - 'oCcU3UKrlqMhuFgMTCKx99VLcc4JbhBf2M+IHf78NtQ9mcQC/X+gxRfp6f+p\n' + - '2RePQzkmUH5vqXjzcUsNBWJPOyjl09/IZWWwaeiUjsPazjxqDtYNHg==\n' + - '=H4X4\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'sheer_ivory_ox', - isPublic: true, - spaceDescription: 'specific_green_alpaca', - spaceCreator: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', - spaceId: 'spaces:bc96011f182e2c86ad68aaf4c95c4a916c808088370cb0ba294f9168e2ff6328', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING' + name: 'Bob The Builder', + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW0EIRRF0esv0k2mGhogp4FJ3AC1UMM2QE66AQ24DZIpwE75E2CtbOmd8/H1+vxmcZ2ZVao4vbCVKk4vOI9nY2WIGWKGWOAmVbZS5S2p4gw8Q8wQM8QCv+gFJ1W2esFJlS1DzBAzxEKcmVUv/KtecGLNrAwxQ8wQC+NoOE/2Zmbn8WzsDDxDzBAzxEKcmZ1xNP4izsyOIWaIGWKBm3E0VnFmVuNo7MSZWY2jsYozszLEDDFDLHBznRmn4sSZecd1ZpyKY4gZYobYD0RQL1bKLk86AAAAAElFTkSuQmCC', + blockedUsersList: [], + verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7dERCZAIZdJAfLB6iRYhBK0xCN+/G/tf7pts7whl0kB8\n' + + 'sHqJAADd9Af/Z4DcYGZyQmVmIXM3CSDf2RaJOsEchm3hN93ErvTwGrKiviKW\n' + + '3/k6HWON3COHqmL5D1wlgZERTqaw3Xft1JC/82P108/IgDHiid4Wo4ojONn+\n' + + 'ZZV6KUfH1i0+wxXNsSvS1XtVYVnq/pQbXi8fzayCYM9jwdiFzBosQTLmXIbY\n' + + 'mUl1OezZ35kPQuZWjtZ2jyATQit6QL0uvQBiGAIevj1LRiB8uQsi0+Xr7R6I\n' + + 'D7WQ0Iwr85OIENGyv1KgrH/1Q944SjamWWI31gUhedH5a+THVLNDJGg3CAfq\n' + + 'FoOb2DNDviovMQxZwUOyCRCxVE6Ohw5Hwkw1YQOvzSwJRzz70l8A8w==\n' + + '=k8OV\n' + + '-----END PGP SIGNATURE-----\n' } ``` +| Param | Type | Remarks | +| ------------------------ | ------------------ | -------------------------- | +| name | `string` or `null` | Profile Name | +| desc | `string` or `null` | Profile Description | +| picture | `string` or `null` | Profile Picture | +| profileVerificationProof | `string` | Profile Verification Proof | + +</details> + +--- + +### **Fetch List of Chats** + +```typescript +// List all chats +const aliceChats = await userAlice.chat.list('CHATS'); +// List all chat requests +const aliceRequests = await userAlice.chat.list('REQUESTS'); +``` + +| Param | Type | Default | Remarks | +| ------------------ | --------------------- | ------- | -------------------------------------------------- | +| `type` | `CHATS` or `REQUESTS` | - | Type of Chats to be listed | +| `options` \* | `Object` | - | Optional configuration properties for listing chat | +| `options.page` \* | `number` | `1` | The page number for pagination | +| `options.limit` \* | `number` | `10` | The maximum number of items to retrieve per page | + +\* - Optional + +<details> + + <summary><b>Expected response</b></summary> + +```typescript +[ + { + chatId: '6168440929ced5109c50534d40bb98a5e109ebf1d33df966ae898f002fac8973', + about: null, + did: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', + intent: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', + intentSentBy: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', + intentTimestamp: '2023-08-29T08:05:03.000Z', + publicKey: + '{"key":"-----BEGIN PGP PUBLIC KEY BLOCK-----\\n\\nxsBNBGTt9AcBCADXjt9OEXDQyE7w2veaHqTUN9fALt7c+cubz2nhWfmD07M1\\n5Spm3ScT/4HdlPpUBYnGUKlCT09g663RvvmDzp8442vZhfYeKbetrcNFxfnp\\n+ePQGiLDY0h2FmjQGkmZGP43ZLyhNT4eCIGPcPSpzaWAKw4wgE/tW2hli5m/\\n7e8HFno+bHp2ycNoPJpdqhY77CJL9zPqFdctCPxI5r1/+xkVLcf+NZ+vD7mz\\nq8xVpu3Tij5Jb5ShDPQ3qqPsqdCcB/fpnEtAOT/Ryuf5Qqic/bDrzImfaIO9\\nYmdnuc6uQBR1s8WbLHmOsQvJhe2D8MtggV5HwHbkPqxXBmpGIJnMeLHZABEB\\nAAHNAMLAigQQAQgAPgWCZO30BwQLCQcICZBvKHl019glPAMVCAoEFgACAQIZ\\nAQKbAwIeARYhBEyKE1gcoT4IIxerrG8oeXTX2CU8AADltgf/dREUaHmfMnwa\\nWwcoGxfya7xeSeqGLWoWsCDg55lq0rf59IFKw59AKL+4kKQrmVDW0x6oo844\\nxBv3NBq7OssNbRr4XYIXJN4oP8g0SdOYinTTcnHFjJcRHfTIa+lmlf7fwc7d\\n2DRW3Kyu66OGq9sLzcgI3Q4Fg3VOQGRDdVGF4zJGjPEpnHsJuGCVnbn5L94p\\nMZHEMIahYrYg2asglSByNUZIH+r0Y8rCzKp8rs37X/Q8RBrmW/oTnE/bb+xo\\n1jHgRR3MUs2Ea0oAqv/TwqpBRzMIWQ8tGKfEaJ22p02FJaE5q9KMbLp0mMIe\\nd33xGwOezLKoK5L9cHKg7wmz4sWvUs7ATQRk7fQHAQgApXcZbj43S5sr7v8d\\nq9JwcXkSdpRuzGw5zyauxUUElq2RLKPvsP8En+OJQceKWQcpvz16xLjnSoZI\\nfgIl1wXUaEb2T45rUrWmnoO+Csy2h6FePNmlHOerY2/C0GHQX3XP/B0t41By\\nG/o4losESsBaHEYugHIg5kXhgsGnlgoC3Bu4zHFmIvLlZXjCWYUG2JnhNHlG\\nrD67/Xuox1FO+Hh/rR7sSsWIH6S+SFgG/P4bwiW0JAYQP6bC4tbXfzvKJk2R\\ndeySnppEAwdn/3lCU5QscYIIUXSaPoV3Q6hg+wRigBk2ixkqdOTJmJROTOo3\\nUdnaeGSwP23USJIUncZWgcIokwARAQABwsB2BBgBCAAqBYJk7fQHCZBvKHl0\\n19glPAKbDBYhBEyKE1gcoT4IIxerrG8oeXTX2CU8AABx6Af/XRamjQ4T79rf\\nhNArQt3VuHvpIUP860MCg0aW5rMtZ8q4+TwOyjiEgOUIFx215Yprb3R3NTKV\\nQWJr8n++ZGDmQ8iro8nrRMRELmoEJzyWp3yr0dyr2lx01//bud+vVw+ARPLt\\nVUnX8eguLKRrltQmIRwCqX01PCTiN2RDB2Akd+zlBGRiHoavW9dDdGGBY9wW\\nA2Pyw73BeMzVA3akiGzLsdRIshO0DBALaX0G5ytqyIf3QjXOqO6C7gp9XW7R\\njXhRhzvR9NjZPmSXEeYqYw2CUPxzaLsKoSP4dbXE7Hl+sYJptzke7LE1StzH\\nG64gRgEYMCKvRZaPXYnPJXAZwDhijw==\\n=8aQd\\n-----END PGP PUBLIC KEY BLOCK-----\\n","signature":"DEPRECATED"}', + profilePicture: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAsklEQVR4AcXBQY0DMRBE0Z+SCRhCsBhGAJiAYQwBgzGmZuDk2pPDSKPsqt57zNfzTVKPxX+K0ciEmTATZqXuSRajkdVjkcVoXKnHIovRyOqeZMJMmAmzEurcUffkF6FOJsyEmTAr3BTqXKks7hBmwkyYFb7UPflLdU+yUCcTZsJMmBW+hDong5O6J1diNE7EJWEmzIRZqccii9G4Eur8oh6LTJgJM2H2mK/nGyNhJsyE2QfJZChdHLm7QQAAAABJRU5ErkJggg==', + threadhash: 'bafyreiewla5iyd7rnvjw2c5w6dbab4zkyf2desbowzouijoea2jzakxz6i', + wallets: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', + combinedDID: + 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562_eip155:0x84a9385e9b97df87b80c2e689997133703853874', + name: null, + groupInformation: null, + msg: { + fromDID: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', + toDID: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', + messageObj: [Object], + messageContent: 'Hello Alice!', + messageType: 'Text', + timestamp: 1693316103747, + fromCAIP10: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', + toCAIP10: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', + encryptedSecret: + '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMA3d9z8TNUuddAQf/U2hMcybh5mUt9FFen5tfZ52PaB0vc2G+wYYIsBfu\n' + + 'zg58rgLy8uGMxvzhtCWhpIE91G62d8M4OmaDa+PLjs8SqyRoyih/9pt8P4cw\n' + + 'UJVHHDcJNC9r6/AV4aZySdz5u5utE7o3iB1FU0Sr9HEQsImmOM7J6LZJ3xWJ\n' + + 'V+o4ToLbqUFYKg2uY1kUXpyX+D6JRinagnAosh4zCICLUqrEkKNqbyV2mr+5\n' + + 'FK+fClWBGCwpf38L220FqHYPQ4bQXks0N07yW4OVjVpCTZVuNttr7PIEqcyZ\n' + + 'qIovbQbkltiDpsb/yYysEHTwBtvugna7xMW7SRY34x3iWm/HBNJmfBG7LnjI\n' + + '6cHATAMrTKobmmcFTAEH/20nW6aNzfj1vn/5GIWjZ5Z4Rw6G3Syt+0NxPUix\n' + + 'dpKIFOR0/BEJkafGMdlk/vRElsyluKbzykBlIQ0hHGRpGMNEW8s8GrJeiXvV\n' + + 'JSNZ24u5DDk8DIBaJWJnyWM7XzgcmOmn9rvVbvc9qgNNgtDeMIZwUpiDipnA\n' + + '++7n72h0JSs8dWFQ62FSf5ACHC0UVbPiL3TRrRBEo7vQp4JsJyXp70CUclqU\n' + + '3ANLvNhINV6GGtpXEKnsBVkkg35HR92nIzk+8HL86SsRUYfXkufzXdkPpmRn\n' + + 'SG7MoDecNf/bwoqP8/l2X2h3R1c+WTQFb6Z+eK/NsJ/AnSErFZh3yEHAi1Rz\n' + + 'yIXSQAEA2KupLnBVC9fqZqhUySvOW/Hs/hD6iEEGIl+U/RC9AwdG2jpg4sVi\n' + + 'f9PhBJ5Tanynb3aHngRKtIzjP5m223A=\n' + + '=5w+B\n' + + '-----END PGP MESSAGE-----\n', + encType: 'pgp', + signature: + '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7fQHCZBvKHl019glPBYhBEyKE1gcoT4IIxerrG8oeXTX\n' + + '2CU8AACRLQf/bbeJoUNwRkJYz100R3ULO27HGjKnFeOaMZWRNF8JqWzNmCBL\n' + + 'Cj3aIBkDuCUj7avBsanScbSa7tD8Mc8PZgpSkd22nNH5iHiDJqlPtySJ2KoZ\n' + + '3ekVXfOgfLlHtN78ghTxABewYQRuB6kwtv3XQW8X9sCL2jEF4NIIl5eXZvIT\n' + + 'nhbHhhOR47k2E0hiHjPv2t3ggrwkrw6ISDgV8qYcrnf7vEFeGHpeSc25QLJH\n' + + 'pXCeeHhH7h4C9L3PEdMt8T+Ne36cfNiwTGdOavin/yfNES6k0kqZxP44hn1M\n' + + 'ZBk4jfyaDUh70mv4FtxdPcdb1TGQsPC1YYAIh/059EBqkdJFhVF4+A==\n' + + '=DBch\n' + + '-----END PGP SIGNATURE-----\n', + sigType: 'pgpv2', + verificationProof: + 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7fQHCZBvKHl019glPBYhBEyKE1gcoT4IIxerrG8oeXTX\n' + + '2CU8AADsmwf/UpJCmnqztJLt1Ltg0OD7xoDvumitRwkfhnXzUdBWxM3i7vj4\n' + + 'cfjtcpQI2R5W0TXj9e2fymimIc98kjUqpDiUIaVAuD0OnEbJdIluGLBTJeks\n' + + 'YTRikqkgjFJT9Y6/2VRQj59IR0rgC0sec8mSKPlxuhixkdSS7Wec0+84cGmX\n' + + 'aieskReKeitKacYkU4Uf82Klc7Ft8+duBsaMGR3TS22PzHfYIHmy+8Z3b1SK\n' + + 'pMyJ8NBXCG2F+05WdoUsXBR+lO74RjSDWnWZlgRngWjjvSXQuZ/QznIyBVmQ\n' + + 'oOxJM5LSCCwH6ch5J/HmXudJG+3wsCINchvSQx0LntZUoeSp8cezvg==\n' + + '=KUqZ\n' + + '-----END PGP SIGNATURE-----\n', + link: null, + }, + }, +]; +``` + +| Param | Type | Remarks | +| ---------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| msg | `IMessageIPFS` | message object | +| did | `string` | user DID | +| wallets | `string` | user wallets | +| profilePicture | `string` | user profile picture | +| publicKey | `string` | user public key | +| about | `string` | user description | +| threadhash | `string` | cid from the latest message sent on this conversation | +| intent | `string` | addresses concatenated from the users who have approved the intent | +| intentSentBy | `string` | address of the user who sent the intent | +| intentTimestamp | `number` | timestamp of the intent | +| combinedDID | `string` | concatenated addresses of the members of this chat (for DM the 2 addresses and from Group the addresses from all group members) | +| cid | `string` | content identifier on IPFS | +| chatId | `string` | chat identifier | +| groupInformation | `GroupDTO` | if group chat, all group information | + </details> --- -### **To add speakers to space** +### **Fetch Latest Chat** ```typescript -const response = await PushAPI.space.addSpeakers({ - spaceId, - listeners: [ - `eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F`, - `eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45`, - ], - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, -}); +// Latest Chat message with the target user +const aliceChats = await userAlice.chat.latest(bobAddress); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| speakers | Array | - | new speakers that needs to be added to the space. Don't add speakers which are already part of space | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ----------------------------------------------------------------------------------- | +| `target` | `string` | - | Target DID ( For Group Chats target is chatId, for 1 To 1 chat target is Push DID ) | <details> - <summary><b>Expected response (add Speakers to space)</b></summary> -```typescript -// PushAPI_space_add_speakers | Response - 200 OK -{ - members: [{ - wallet: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGSs51IBCAC+y8oXbU2YvfI7Z4xnSRfcPecRR+nO/XVLDbt30mbn1NU8\n' + - 'wHSXcuHLJTuU9yJy1t9AMB2SY8n/YWMFbeNICF0OQVINkvFS+8Ec/F42IIlb\n' + - 'StUY8rLS9pxTQoI3k1LnQKNL1krGiEuDl2ZT3l304aPGkF1sowu5w6xnzl/o\n' + - 'nb6cgc48jVqIgqoVUCnEoxc3GKdSORm35nl0RBDasFdFPJctnpg2n7hLofU1\n' + - 'RGOIzf/cITY7AE3nta0cqaFgNsO4rO0fXRwgDBAu66CtBG4Px2X8hT7IYMum\n' + - 'XJtCis3KvrmQAOhWrbAwmWjHbkSDSYigd39rmlht21GKf0/kfoILBgRfABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKznUgQLCQcICZDTsTetOyJa2gMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBHGBWhlF6JChmgQO7tOxN607IlraAADq/Af/XWeAagX5+JCX\n' + - 'ChzadMaUtI6m2F7nT8sJcJep/a0Ldyz6kPmP9k6kmWO+QXJwl4FrP3e7HPer\n' + - 'SjTeIWm0FJ2a+pRtF+lWk7xjIWJuZxbx79nOk98arde75fT+bebne1V0raUM\n' + - 'gXPQIc60++okAPif6vJVLAaSMNbCkv8+Lsy0mJqsjY3b9iMVKWHKb8XVvTuN\n' + - 'pobxVV4dLq53lrdNDIiwAWTlbxyuKLSEF4f+hIPJX3PAhquORinOubclUwTM\n' + - '+kEmE6VI3pW4VL1VRi10cDI6ruEVwqOwQyYcp9gSDKXFR6ZXz7t0hjUUhl+3\n' + - 'z6T7yqAjExW1O4tETVSbt3jg6DjaAM7ATQRkrOdSAQgArRRrLZees3xCYyBO\n' + - '9WDzy7XCM2FxmaIJs/ibWwTtD1ZVoc9NKeOx07FYwGiYjigY6FxxJHdr20IQ\n' + - '3xieIyBLZM2XAIXrsxq4M9GLG8R6nhd35BenjcvSGiZH1Rq0aXtFt9Fd7gc6\n' + - 'E8XpMcHPH8KEnf66sPz18vrVCdstVU4Qj2ZjH25ilfeGdMj2HHfDxVN8sRhl\n' + - 'AXAcwblQ+IVXGjuKw19T4zN874bcAaOmXfzxu3+2PtxVSR5uV03x1ln3ji+b\n' + - '+GF8atJMMHCqE0FC/dEciS+BWSQtv0D93XWjzExJeyhd7Z+I3BG8JPuJT5Yj\n' + - '4PxktEgwUxQc83JFFwED9knzyQARAQABwsB2BBgBCAAqBYJkrOdSCZDTsTet\n' + - 'OyJa2gKbDBYhBHGBWhlF6JChmgQO7tOxN607IlraAABLdggAhe1KLjtHTsUI\n' + - 'SR0K25EJ+9gXC7wmebve9wNZL22/Ud9hnyS77/VUmMNBgdPyhm/9ITMhVtTt\n' + - 'rRNo1AzsVKDn3/dW1kc+nSribOufxzMoBM7Bm918Zt/0/7wCegz0bp3EAoQ8\n' + - 'KEa2KPY9lSh2WtEDoA87D8JB1xwIfcR98vg5/AZ7VdtE88foSqXAm+6F85hz\n' + - 'nAASNBO9CCDvUofR28b4exT/aWX0qZxLAukgH7fnYC3KPVv+9ug6mdyJPsOZ\n' + - 'LFjF327UKLrBuQ6VRlfKF+XULJbtNPxckgwO1V/oxycq/M67acGoXgc2MgP/\n' + - '2qOkbiQC0ZxcA+Ze5TNNhuGWKv6d9g==\n' + - '=S9Ba\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1UlEQVR4AcXBQU1FUQxF0f2bZ6gaIOkAC4yxUCRQHyRoqIo6wcJnesLgEgJJ17p9vDzeEe9vd046nZOo4eT59YYylhnLjGW3p8+HOwedzl9EDSfGMmOZsezim05HRQ2q0zmJGlSno6IGZSwzlhnLrk5HRQ2q01FRw0mno6IG1ekoY5mxzFh2RQ2q01FRw29EDarTUVGDMpYZy4xlV6ejogbV6aio4aTTUVGD6nSUscxYZiy7+KbT+U+dzomxzFhmLLv4QdSgnl9vHNWgOp0TY5mxzFj2BfKPPQUA5ipXAAAAAElFTkSuQmCC' - }], - pendingMembers: [{ - wallet: 'eip155:0x4d2eFB18383a48aCe19a198ae5228BB4bf854cec', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9UlEQVR4AcXBoZHDMBCG0S87ZqEmooaiLmJJsNtwIyFuwzhERZgKmoqkhxz9HaCbmwP73u159w8iN0fVVFC5OT01FVRujqqpoIxgRjAj2JCbo6b1QE3LiDrpeywjF+vBRXOUEcwIZgQb+MW5zaiaCl3NUdN60GMEM4IZwYaaChfNUdN6cNGcnmk9UOc2o2oqKCOYEcwINuTmqJoKF835i3ObUTUVVG6OMoIZwYxgt+fdP4jHMqJe+xuVm9NTU0E9lhH12t8oI5gRzAg28OXcZlTeuKip0JObo06+7AVlBDOCGcFuz7t/6MjN+Y+aCj1GMCOYEewHE5pCbf3G8WQAAAAASUVORK5CYII=' - }, - { - wallet: 'eip155:0x8E50Bfb57f803814c242c5a25890f5F0c13304fF', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsWkDQRCG0W+Gy53pkgVVsiXYFVx2rsANiCtEmQoxbCHmYBNd6gLW6aBgjDDmf89eXr8GiW6VqIxGplslKqORccQcMUdsWued6Ho/k+lW+Yt13okcMUfMEZt4sM470YUb0XYsZC6nG9HKTsYRc8Qcsel6P5PpVnnGdixEZTQyjpgj5ohNPOhWyZTRyHSrRN0qURmNyBFzxBwx+34rg0QZjahbJVNGI+pWyThijpgjNvGLbpWojEamW+UZjpgj5ojZx/vnINiOhf90Od2IHDFHzBH7AWIQNGL6hyehAAAAAElFTkSuQmCC' - }, - { - wallet: 'eip155:0xaA6E4434D881D2bDEea891AE127313AE5515a06B', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyklEQVR4AcXBsZGDMABE0c8OqQPGZShzCdCCVNZVIhVAYrpQ6g48lMClkgMlBPve9HjtF0bCTJgJszmXykiKgTtyqYwIM2EmzOYUAyO5VO5IMTAizISZMJu/70rrOOmkGLgjl0prXegIM2EmzKbHa79o5FIZSTEwkktlJMVAS5gJM2E282Nd6Dy3QCuXykiKgdb3XRkRZsJMmE375++isS50jpNOioGRXCqtdaFznHSEmTATZjM/nluglUvljucWaOVSaQkzYSbM/gGGCDCC/3c1nwAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xf6106dd699B6e40f1E822c38DDA459F533470b11', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAwUlEQVR4AcXBsU2DMRSF0S9XHoIFIipmIEW2sPQ6pmGEdJa8BYXXsOgYxKF9afzrr+45l++39uSEUGenrcoZwkyYCbPCgVAna6uyE+pkbVV2hJkwE2Yl1MnaqmT364Ps5/eLnfv1QRZzkIU6mTATZsKscCDm4IXYijk4Q5gJM2FWONDeb7yYbLX3G1nMwY4wE2bCrHAg5iALdbYmpwgzYSbMLh+ff0+MhJkwE2Yl5iALdXbaquyEOjttVTJhJsyE2T84uix63kKmNgAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xAF3d4989652a6ED5554b6191c555525977424Cc9', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA3UlEQVR4AcXBsW3DMBCG0c8/tEMmUClkBDVaQAWHIKAZWHAGAxyChZDejbOCkcrDOO3ZxQlGENx7p4/t64Gj58JfpFbxiGAimAg2cOB6uWHNy4TnernxDhFMBBPBBl70XHg2YaVW8fRcsOalYKVWsUQwEUwEGziQWsXqueBJrWL1XPCIYCKYCHb6/vl8YKRW+U89FywRTAQTwQZebOOK53zf8Wzjim/CEsFEMBFs4MD5vmP1XPCktmNt44pHBBPBRLAhtYrVc+HZipXajmcbV6x5mbBSq1gimAgmgv0CTksv6eJNDqkAAAAASUVORK5CYII=' - }, - { - wallet: 'eip155:0x2ccBeEf6e30dF46D0A7Ee79Bc66FBF3beA7EeA5A', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA00lEQVR4AcXBIW6AMBiG4XdfmnAYboLlCE3NFBLX4JB40hMsWM4x08OgNvsXUbMs//N8fH59/2DksfCfthqxhDPhTDgLvGw1Yq3nhLWnm571nLD2dNMjnAlnwlnIY8HaasQajplGpWs4ZhqVRh4LlnAmnAln4VkuGinSs54TXcdMz7NcWMKZcCachT3dWHksWM9yYQ3HTM+zXFj5oLGlG0s4E86Es8DLViONFLEyhZ493TQqXcKZcCacCWfCmXAmnAVe8lj4izwWerYasYQz4Uw4+wXktDHpzVVJlwAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0x65585D8D2475194A26C0B187e6bED494E5D68d5F', - publicKey: null, - isSpeaker: true, - image: null - }, - { - wallet: 'eip155:0xE99F29C1b2A658a478E7766D5A2bB28322326C45', - publicKey: null, - isSpeaker: true, - image: null - }, - { - wallet: 'eip155:0xa145b34443e28C8f718Cd0691Dc41A81E0d0A857', - publicKey: null, - isSpeaker: false, - image: null - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkrOdUCZDTsTetOyJa2hYhBHGBWhlF6JChmgQO7tOxN607\n' + - 'IlraAAAqUQf9FvAtNouG7+2YSyyx7eiHRJZroDPFohH/F2xyc+oJkgh40p2y\n' + - 'hyKw+DSp0FA+IiT95/y8RbGDUrNFz+/kdMfZWCEYFim3Cy+c5k1/YNc8qxx6\n' + - 'VLwef+2YZepC1pSS9K0zbu04uVPWrNmDa5lHXqzTx/mOxWlxLD0NfpI60csE\n' + - 'iQx57duy2gMeW9MwOKSFjOSnWHKy7AySm/vBwZ9Rj4gnOhsvwbAfLprQQf4G\n' + - 'cUaxG/HOb0c/8Ugews0Z1uDJFmGKjT5R5CR63vPo5qDGQwWkm+LYpshCIV+K\n' + - 'ofLepDqQRuEFa7VyUlDOvMcF15LtlvAhwhkIVHvTGjXZC91e8/IUsQ==\n' + - '=UpR2\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'weird_moccasin_alligator', - isPublic: true, - spaceDescription: 'equivalent_blue_armadillo', - spaceCreator: 'eip155:0x4Be8cFD08B330853A530DEBB72a2DAf4d4F3D2Ba', - spaceId: 'spaces:d37c4e303a2ff194e546d3af94353ec829324a578ebffbeadebd1ba91ab88548', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING' -} + <summary><b>Expected response</b></summary> + +```typescript +[ + { + link: 'bafyreibfikschwlfi275hr7lrfqgj73mf6absailazh4sm5fwihspy2ky4', + toDID: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', + encType: 'pgp', + fromDID: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', + sigType: 'pgp', + toCAIP10: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', + signature: + '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBQJjh5tjCRBaJmgmByp5FRYhBJC23yBJT2d/pTAID1omaCYH\n' + + 'KnkVAAAZmwf/buPLw6caSZmYnw6D3/p6HF1kWlkGUOTP4RasaU/6dkeDaZs9\n' + + 'SJlz2wC8oOpBGWHMJ/5n3ZWmU71E6U7IKIY793MyIv5t32vTNkwsRHUX7IIn\n' + + 'QFF+FzTIEtHHVTRlnkqNR2YUk1kqcpZCZWHfahi5W2d/WkXlFNdvyyFH4W8L\n' + + 'd03FGhOyXbWwU3xicBz5mSBpIFaaSCXl1SdgJDPXLSk3b65EEOjCOaiz85xC\n' + + 'G+6SW4RUzCGSDcOd9F2EXvvY5H9LgQNi1jjlZn6JrPTPJTJ+wXZXzcZmtOXG\n' + + 'EKcwvPbbPY9wd+gavRSOgYLYn5xoZQW/o3hW7AQlbC5Kj6js48Z0HQ==\n' + + '=qLiJ\n' + + '-----END PGP SIGNATURE-----\n', + timestamp: 1669831523684, + fromCAIP10: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', + messageType: 'Text', + messageContent: 'Hi', + encryptedSecret: + '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMA1fn1CNqxQ7nAQgArlo75qe54WerfRKFv1+F9j4NRMvSTgUztvIe51eg\n' + + 'd5MVuj6RYxKERr2bTuBt5cMDJMlNuTnBBkPe4L8+SlsI46L9wmXV9xLoZq1a\n' + + '94JdxD98RGMF99Jde/3hC/X6GS1yVqPpKPKdWx/tkOPeyqeO/wFF7kqShgIi\n' + + 'Wgq6hGz1fzD3GZhKGY0VSLuC3s0aUy/qw5En1Xd0uX0jdXBl07IIj8p1G2zx\n' + + '9BuVlksSK34yvIc0RQfCeRadMHkxbA0Hyj31Wrr+Y310YLTppL0s5bQR9APL\n' + + 'WHsIztJ1fHTnXsPhnA7YG0SQpHTyJhuX3rgBjxGrvbZBArmZ+R/Pq9IkOkJe\n' + + 'z8HATAMOsbaZjGN5JwEH/jYjLN6AFRWeaB5CSBSAF+CvHsUgadGmxTdSHBM6\n' + + 'LM9rfGg/MCnpRBuHckA0NNZh+wepq6TDA54ZopsdP14gHj4MKCdfqZr86Jft\n' + + 'ldtjeSgPTFEEJxPMJ4/Z3UeFU9rvOgfxX6l0eHWS0MYwJ3sVYvSyqqHir1K5\n' + + 'TRdEIgtQ3NvLTKkX4bKTSU+SInrvDA+wsc2BcBsbgNhRiGb+XYrbqXBshL1a\n' + + 'lIdpnomkAQgOZMO2n347uURYoruH3OtFeNABJ9D/nEU+LdhDOPGZPefvPBc5\n' + + 'BxK4ExKZ2Wo/TZw8lgC53uqOljsGV63Hp71LkyesKWu5/+vdVrYx/vU63shh\n' + + 'x/TSQAEiaFYEfkWSOthtH0nrJHhkY7FWgjp/1bj/J4J9HCQrVtt2WlQfhowZ\n' + + 'ILxhKk/vep0sJviM3SfJ4hPtoYpZESc=\n' + + '=43Ta\n' + + '-----END PGP MESSAGE-----\n', + }, +]; ``` +| Param | Type | Remarks | +| ----------------- | -------- | ------------------------------------------- | +| `fromCAIP10` | `string` | sender address | +| `toCAIP10` | `string` | receiver address | +| `fromDID` | `string` | sender did | +| `toDID` | `string` | receiver did | +| `messageType` | `string` | message type | +| `messageContent` | `string` | message content | +| `signature` | `string` | signature of the message | +| `sigType` | `string` | signature type | +| `link` | `string` | content identifier of the previous messages | +| `timestamp` | `number` | timestamp of the message | +| `encType` | `string` | encryption type | +| `encryptedSecret` | `string` | encrypted secret | + </details> --- -### **To remove speakers from space** +### **Fetch Chat History** ```typescript -const response = await PushAPI.space.removeSpeakers({ - spaceId, - speakers: [ - `eip155:0xB12869BD3a0F9109222D67ba71e8b109B46908f9`, - `eip155:0x2E3af36E1aC6EEEA2C0d59E43Be1926aBB9eE0BD`, - ], - signer: signer, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, -}); +// Chat History with the target user +const aliceChatHistoryWithBob = await userAlice.chat.history(bobAddress); ``` -Allowed Options (params with _ are mandatory) -| Param | Type | Default | Remarks | -|----------|---------|---------|--------------------------------------------| -| spaceId_ | string | - | space id | -| speakers | Array | - | existing speakers that needs to be removed from the space. Don't add speakers which are not part of space | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev'| +| Param | Type | Default | Remarks | +| ---------------------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `target` | `string` | - | Target DID ( For Group Chats target is chatId, for 1 To 1 chat target is Push DID ) | +| `options` \* | `object` | - | Optional Configuration for fetching chat history | +| `options.reference` \* | `string` or `null` | - | Refers to message refernce hash from where the previous messages are fetched. If null, messages are fetched from latest message | +| `options.limit` \* | `number` | 10 | No. of messages to be loaded | + +\* - Optional <details> - <summary><b>Expected response (remove Speakers to space)</b></summary> + + <summary><b>Expected response</b></summary> ```typescript -// PushAPI_space_remove_speakers | Response - 200 OK -{ - members: [{ - wallet: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGSs6YABCADC4ldJKGpZ0Z+JJwA1t/1JWp5+dnR98nr7RHPX8eEGxIhL\n' + - 'gtx5TZmek2BcGzNcg66+GEyC4np9USaCZ4/YC9ZMLw8BQKzhOcd3ZILyGtGV\n' + - 'BijBNwjPIbQcy5/cXVtfKCvf303BDYddPYuJ1xFAh7kpvhcR4a72CSpeyEjM\n' + - 'UndteAVTIxqwdpnXIdqpwu6HrSJ089GpHV+XeaDo4Uhg+iHJsCRJy2VJ5m61\n' + - 'CwGx55f3ror6rAXQd+hEx+keLxYINNJLLvfvE9IGsIbKRFZx+emjXQZusbJp\n' + - 'zXYhJnEeHPLVDjWhzo8Q3/4gvOz8m6a+A9sl49sqodLdxVlXQ7d4CuylABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZKzpgAQLCQcICZCaDezdj8j4SwMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAACCLgf/dB412nDRcOxR\n' + - 'dNSj2AYknJ+NKeX38KuksyR6wypnaJWpapmIeZCfFjeoBjuBCPd6unvN/IlZ\n' + - 'zPwl66lO5GKJxDaDd1/infxM/dbtFQSESLXlweRLQ/v1+plsntrBUyvbY4uH\n' + - 'Mh9PImYsLY+zo8P5mpBV5AGAMA6R9qmu3axH/MnKVdB0Ky6C/jP+7lPs/QVT\n' + - 'qsISyyI1E9E6Oivzxmao1axfXLdEvICHb6uD0R4p5SUVqHJX41OwM8BFevhK\n' + - '07Hi+c7NhUWp0sxXEOs6dneJZwerCD3EahutpP1Oyt5T8MZitysn2yJ+s5ks\n' + - 'SZza+x8OmCMcMZfZnIsJNnIUvPboP87ATQRkrOmAAQgAteDgsJJ0ftPD+P15\n' + - 'rKgkLuSCD2iwQgm2k8/ZDaXJBsdm4sJYTt2y0ckx7MRpXgLuIyidOGctqVL6\n' + - '/Rl2Hfl30JQPok5cYmYLENVuFz94MEvgDOo8jacyfPdLGPMWZMLRojyM/Yvs\n' + - 'nhDZ8if3zEstP4h3HcpdT+PWSmsJWjrq57la4vKbfILtKfTBaf8sibm5UuZA\n' + - '5Y/SIPxfVC+ybCPAjo4tpDYP901V+wxXDJ8BlZ4AaVvk20MYMzuAjBna+iwD\n' + - 'f0j4CccEabd2EVtAQQcMCg2yTjOT22Dt0jfpDuohDNaXDhX2ZQlJIdlSLCEI\n' + - 'a3c7g+uU9bnNqt7LHPgMzLYKnwARAQABwsB2BBgBCAAqBYJkrOmACZCaDezd\n' + - 'j8j4SwKbDBYhBGZpOFBNtTj1Oqt695oN7N2PyPhLAAD2vQgAu9+sd4AT5b6c\n' + - 'mWOaQBXz2XVfJXYQFNlBdOF23reycF9r7vDAKSRpeyMSyOfRAi0qdLynQ1dN\n' + - 'MXV/gfO0G9dzFu513P/Y1sZxQi0uLRKL9hMcgEQ8FLo8/PGfVcoLfQASryGj\n' + - 'Z8ybCFqiXocGpt2VkkK4wwgv+ZwZ8M1ubz0Boby6A1/kTYs/6ll+QekpB4ao\n' + - 'kJKw3DWvVNR/xODFfMQcClvzAtqwfxhTZXBMbZ4vAG5m1ExGmA15cGXrAfwV\n' + - 'nR2vOhPYDeZGbBKktM3xfDts75N2NF/TBpvazV2DTKpkLqvVitFHWvSMMpVd\n' + - 'dwk9tEOmBlj2AoYATvQ9kKHRTD27Wg==\n' + - '=IXzf\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isSpeaker: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA1klEQVR4AcXBoXHEMBRF0Zs3oqpHNYgJecZdGKYMd5GZRWaCwaohZbiAhP5d8HeC3jkfnz/fvwSTRua+DjJ1nGQ6i0iYCTNhVnjRWUSTRlTHyX90FhlhJsyEWeHFpJG5r4NMHSfRpBF1FpEwE2bCrPDGfR1E29jJPK6DqI6TjDATZsKsTBqZOk6iSa6ORmbSiISZMBNmpbOIHtcXUR0nUWeRmTSi+zqItrETCTNhJswKL7ax82wRTRqZzuLJ2MkIM2EmzApvTBpRZ5GZNKLOIiPMhJkw+wPV2i2sD43hKwAAAABJRU5ErkJggg==' - }], - pendingMembers: [{ - wallet: 'eip155:0xC1469cB7b59d16dC887D4C11faB3E3C0abBeA12C', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsWnFMBSG0e9dBAGDPUs6LeAFNIEb1x5GtRtDei3gBQzZIFtYYEj10t73CkFw8Z/z+Pj+euJs14iXlsodJfd4U7fjGWKGmCEWzjnilUzTsB60nHOk5ZwjniFmiBligTdTt+MlIt52jbRVvKnb8RIRzxAzxAyxx+/nzxMhQ8wQM8RCyT0taancUXJPiyFmiBligTdTt+NNKy/OOdIyrAct2zXiGWKGmCEW0lJ5kUe8tFT+45wjXsk9XloqniFmiBliYVgPvHOOeCX33JGWijesB54hZogZYn8uFTTKoy9pgwAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0xccF7a3131E0E73F83Bc457C27494411a57f23248', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA9ElEQVR4AcXBIWoEMRSA4X8fw6qayBW9zULVEBFygLqcqMwdhlBCbKjqXSLjY7b2UZEVpbzvu3x8vT5QShhoqUa0Yz9ZSTWiHfuJ5rNDE4wJxgRjl8/v9wdKn43/dLve0QRjgjHB2NZnQ7td72h9NrQSBis+O7Tb9Y7WZ0MTjAnGBGMbv/TZ0EoYaD47VkoYaD43VgRjgjHB2MYTqUa0Yz9ZSTWi9dlYEYwJxgRjlzf38kDx2aGVMNBSjawc+4nms0MrYaAJxgRjgrGNJ1KNaH02VlKNaH02VgRjgjHB2OazQythoKXKn5Qw0Hx2aIIxwZhg7Ae2cUcV4Bl8pAAAAABJRU5ErkJggg==' - }, - { - wallet: 'eip155:0x052aD82D3a7b4DAb5b9BcFED771D28703a6faadf', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAy0lEQVR4AcXBoXFDQQxF0RtlkZsQNjHICKYYV7DFCAW6II2BycfbhklCNR/sTNA75+Pn+/MXIUPMEDPEBifhSVdr0oUnO7UmXXjS1Zp0hpghZogZYoaYIWaIDU5qTbrwpHtfnuyEJ12tyY4hZogZYiM86WpNdl7Hg53wL3bCk84QM8QMscFJeNLVmnS3652dOiZdeLJjiBlihtioNenCky486eqY7IQnO7UmnSFmiBliIzzpak262/XOf7wvT7rX8aALTzpDzBAzxP4AMOQyARcWaToAAAAASUVORK5CYII=' - }, - { - wallet: 'eip155:0x956f73E5a3BF0D19299BF74bD6dc819D7f775eC7', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA20lEQVR4AcXBsYnDMBiG4dc/nsHgHeJWS1x7G6QzqNQUKlUHLn12ONdqNYTBS/ja/xqBCeF7nmFbbydODoVPSjXiGWKGmCE2Pu8vvPT45pOe9xeeIWaIGWLj0Xa8HAo9qUZ6cih0tR3PEDPEDLFhW28nTg4FL9XIO3IoeKlGPEPMEDPEhq+f3xNnWmZ6jrbTMy0zPUfb8QwxQ8wQG6dlxjvajpdq5JLKPzkUvGmZ8QwxQ8wQG4+246Ua8XIovCPViJcpeIaYIWaIDdt6O7kgh0JPqpErDDFDzBD7AzabOPmHFg/aAAAAAElFTkSuQmCC' - }, - { - wallet: 'eip155:0x19da526eD1a57E07D48aa25aDa6cbA7E41FF3129', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAyUlEQVR4AcXBsY1CQQxF0cvTFEHuNn4jxB6JJggpw5Mh/UZogmByumBTi2DQahf5nMN2vr1IjvtG1ufgL8Kc7Hm6k4liopgo1i7XB1nsG990uT7IRDFRTBRrfBDmZH0OVsKc3xDFRDFRrPFBn4MszFnpc5CFOSuimCgmih228+1Fctw3vul5upOJYqKYKNaO+0bW5yALc7I+BythTtbnIAtzMlFMFBPFGm/CnP8U5qyIYqKYKNZ40+dgJcxZ6XOwEuZkopgoJor9AIckL2mEiBQrAAAAAElFTkSuQmCC' - }, - { - wallet: 'eip155:0x77059B40Ec974883b98a23eef519b4076D1Cf9F1', - publicKey: '', - isSpeaker: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsY0CMRRF0cuTQ6rYaQFiAvdBYMkFkFEAwWYTryxZ2kIcEE8N1MKmH4JJRuw7Z/d7uD0JRu1EuRW2GLUT5VaIhJkwE2a788/XEyNhJsyEWcqtEI3a+aTcCpEwE2bCLI3aia77E9EyT2xxvDyIvmsnEmbCTJgl3izzRDRqJ8qtsGbUzou58KLeiYSZMBNmKbfCf8qtEAkzYSbM0qidTxq1s0aYCTNhlq77E9EyT2yRW2HN8fIgEmbCTJj9AUPBKWCCQlIAAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkrOmCCZCaDezdj8j4SxYhBGZpOFBNtTj1Oqt695oN7N2P\n' + - 'yPhLAAD+iwf/dvaRCTwXKGH6iUe49NpyTHMaD6ZwaLerk+K4Ojehbdoo0mDf\n' + - 'aOu/MR8wfqk49h2436rcMmyeM5avcMgmtGUmIdy/6hCZ6zxR/3E5t/vq5UfO\n' + - '3YFO1VLghR5cTYqR9bMLFkvvCB4P29rnaok2QVKTBZLfyAM4wu1h2DDBESoz\n' + - 'SS+ZtQLPz6/y7gOQobO0zbwBPmy8MpVVu1wxht+sneOMvZX+5al679nQbwNL\n' + - 'oCcU3UKrlqMhuFgMTCKx99VLcc4JbhBf2M+IHf78NtQ9mcQC/X+gxRfp6f+p\n' + - '2RePQzkmUH5vqXjzcUsNBWJPOyjl09/IZWWwaeiUjsPazjxqDtYNHg==\n' + - '=H4X4\n' + - '-----END PGP SIGNATURE-----\n' + - ':null', - spaceImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'sheer_ivory_ox', - isPublic: true, - spaceDescription: 'specific_green_alpaca', - spaceCreator: 'eip155:0x5908D89B1390ec5833001b86302B868A808D506D', - spaceId: 'spaces:bc96011f182e2c86ad68aaf4c95c4a916c808088370cb0ba294f9168e2ff6328', - scheduleAt: '2023-07-15T14:48:00.000Z', - scheduleEnd: '2023-07-15T15:48:00.000Z', - status: 'PENDING' -} +[ + { + link: 'bafyreibfikschwlfi275hr7lrfqgj73mf6absailazh4sm5fwihspy2ky4', + toDID: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', + encType: 'pgp', + fromDID: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', + sigType: 'pgp', + toCAIP10: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', + signature: + '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBQJjh5tjCRBaJmgmByp5FRYhBJC23yBJT2d/pTAID1omaCYH\n' + + 'KnkVAAAZmwf/buPLw6caSZmYnw6D3/p6HF1kWlkGUOTP4RasaU/6dkeDaZs9\n' + + 'SJlz2wC8oOpBGWHMJ/5n3ZWmU71E6U7IKIY793MyIv5t32vTNkwsRHUX7IIn\n' + + 'QFF+FzTIEtHHVTRlnkqNR2YUk1kqcpZCZWHfahi5W2d/WkXlFNdvyyFH4W8L\n' + + 'd03FGhOyXbWwU3xicBz5mSBpIFaaSCXl1SdgJDPXLSk3b65EEOjCOaiz85xC\n' + + 'G+6SW4RUzCGSDcOd9F2EXvvY5H9LgQNi1jjlZn6JrPTPJTJ+wXZXzcZmtOXG\n' + + 'EKcwvPbbPY9wd+gavRSOgYLYn5xoZQW/o3hW7AQlbC5Kj6js48Z0HQ==\n' + + '=qLiJ\n' + + '-----END PGP SIGNATURE-----\n', + timestamp: 1669831523684, + fromCAIP10: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', + messageType: 'Text', + messageContent: 'Hi', + encryptedSecret: + '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMA1fn1CNqxQ7nAQgArlo75qe54WerfRKFv1+F9j4NRMvSTgUztvIe51eg\n' + + 'd5MVuj6RYxKERr2bTuBt5cMDJMlNuTnBBkPe4L8+SlsI46L9wmXV9xLoZq1a\n' + + '94JdxD98RGMF99Jde/3hC/X6GS1yVqPpKPKdWx/tkOPeyqeO/wFF7kqShgIi\n' + + 'Wgq6hGz1fzD3GZhKGY0VSLuC3s0aUy/qw5En1Xd0uX0jdXBl07IIj8p1G2zx\n' + + '9BuVlksSK34yvIc0RQfCeRadMHkxbA0Hyj31Wrr+Y310YLTppL0s5bQR9APL\n' + + 'WHsIztJ1fHTnXsPhnA7YG0SQpHTyJhuX3rgBjxGrvbZBArmZ+R/Pq9IkOkJe\n' + + 'z8HATAMOsbaZjGN5JwEH/jYjLN6AFRWeaB5CSBSAF+CvHsUgadGmxTdSHBM6\n' + + 'LM9rfGg/MCnpRBuHckA0NNZh+wepq6TDA54ZopsdP14gHj4MKCdfqZr86Jft\n' + + 'ldtjeSgPTFEEJxPMJ4/Z3UeFU9rvOgfxX6l0eHWS0MYwJ3sVYvSyqqHir1K5\n' + + 'TRdEIgtQ3NvLTKkX4bKTSU+SInrvDA+wsc2BcBsbgNhRiGb+XYrbqXBshL1a\n' + + 'lIdpnomkAQgOZMO2n347uURYoruH3OtFeNABJ9D/nEU+LdhDOPGZPefvPBc5\n' + + 'BxK4ExKZ2Wo/TZw8lgC53uqOljsGV63Hp71LkyesKWu5/+vdVrYx/vU63shh\n' + + 'x/TSQAEiaFYEfkWSOthtH0nrJHhkY7FWgjp/1bj/J4J9HCQrVtt2WlQfhowZ\n' + + 'ILxhKk/vep0sJviM3SfJ4hPtoYpZESc=\n' + + '=43Ta\n' + + '-----END PGP MESSAGE-----\n', + }, + { + link: null, + toDID: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', + encType: 'PlainText', + fromDID: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', + sigType: '', + toCAIP10: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', + signature: '', + timestamp: 1669831499724, + fromCAIP10: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', + messageType: 'Text', + messageContent: 'Hey Fabio!', + encryptedSecret: '', + }, +]; ``` +| Param | Type | Remarks | +| ----------------- | -------- | ------------------------------------------- | +| `fromCAIP10` | `string` | sender address | +| `toCAIP10` | `string` | receiver address | +| `fromDID` | `string` | sender did | +| `toDID` | `string` | receiver did | +| `messageType` | `string` | message type | +| `messageContent` | `string` | message content | +| `signature` | `string` | signature of the message | +| `sigType` | `string` | signature type | +| `link` | `string` | content identifier of the previous messages | +| `timestamp` | `number` | timestamp of the message | +| `encType` | `string` | encryption type | +| `encryptedSecret` | `string` | encrypted secret | + </details> --- -### **Fetching list of user spaces** +### **Send Message** ```typescript -const spaces = await PushAPI.space.spaces({ - account: string; - pgpPrivateKey?: string; - /** - * If true, the method will return decrypted message content in response - */ - toDecrypt?: boolean; - /** - * Environment variable - */ - env?: ENV; +// Alice sends message to bob +const aliceMessagesBob = await userAlice.chat.send(bobAddress, { + content: 'Hello Bob!', + type: 'Text', }); ``` -| Param | Type | Default | Remarks | -| ------------- | ------- | ------- | ---------------------------------------------------------------------- | -| account | string | - | user address (Partial CAIP) | -| toDecrypt | boolean | false | if "true" the method will return decrypted message content in response | -| pgpPrivateKey | string | null | mandatory for users having pgp keys | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev' | +| Param | Type | Default | Remarks | +| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------- | +| `recipient` | `string` | - | Recipient ( For Group Chats target is chatId, for 1 To 1 chat target is Push DID ) | +| `options` | `object` | - | Configuration for message to be sent | +| `options.type` \* | `Text` or `Image` or `Audio` or `Video` or `File` or `MediaEmbed` or `GIF` or `Meta` or `Reaction` or `Receipt` or `Intent` or `Reply` or `Composite` | - | Type of message Content | +| `options.content` | `string` or `{type: `Text`or`Image`or`Audio`or`Video`or`File`or`MediaEmbed`or`GIF` ; content: string}` [For Reply] or `{type: `Text`or`Image`or`Audio`or`Video`or`File`or`MediaEmbed`or`GIF` ; content: string}[]` [For Composite] | - | Message Content | +| `options.reference` \* | `string` | - | Message reference hash ( Only available for Reaction & Reply Messages ) | +| `options.info` \* | `{ affected : string[]: arbitrary?: { [key: string]: any } }` | - | Message reference hash ( Only available for Meta & UserActivity Messages ) | -**Example normal user:** +\* - Optional -```typescript -// pre-requisite API calls that should be made before -// need to get user and through that encryptedPvtKey of the user -const user = await PushAPI.user.get({ - account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', - env: ENV.STAGING, -}) +<details> -// need to decrypt the encryptedPvtKey to pass in the api using helper function -const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: signer); + <summary><b>Expected response</b></summary> -// actual api -const spaces = await PushAPI.space.spaces({ - account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', - toDecrypt: true, - pgpPrivateKey: pgpDecryptedPvtKey, - env: ENV.STAGING, -}); +```typescript +{ +fromCAIP10: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', +toCAIP10: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', +fromDID: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', +toDID: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', +messageObj: 'U2FsdGVkX1/S1wljx7jN0NXJzSNoJCkg/6cw7gHwVibLsqyhpe/XgzJi7OUrXwUh', +messageContent: 'U2FsdGVkX19oSSMVZpQdw+jZRExfd1GvJkIwgWAGe5g=', +messageType: 'Text', +timestamp: 1693316104031, +encType: 'pgp', +encryptedSecret: '-----BEGIN PGP MESSAGE-----\n' + + '\n' + + 'wcBMAytMqhuaZwVMAQf+KkUcX1rmNnorm0bCeGPknnjMBFn2wQ4nIAbQV5cW\n' + + 'W7bCHneK0V0+kpronJwuPb8e8GUZiJEmJGdTJYf3XMVP8sJkVVVQEbvYvAJL\n' + + 'tUEsdqgqRuqGB+u4k5shtlHN1ViTjjc1N97C0eQUqTCVFKa1Ul9eZirhDqiI\n' + + 'C/rj8uxESy+NH7o/nnbGTlwQonOOLLHfGH2zCpl/F59CO2CcLnuecfDT0WxJ\n' + + 'xi2hM/ovKgbsKVI8WOOde0sIV3MQEvxAFuPJ8gINpoDA28Ty+lf7x1bN9ONN\n' + + 'RZl4yjLpA7KUojWyfjp1/UW635NY11aZYEXIygDppCCvf6AE7je+1FDaVR/B\n' + + 'I8HATAN3fc/EzVLnXQEH/1H4r6FubywzPzRlDJzPgxyNpNGPZbexrWRQT5U4\n' + + 'eHmh7EsOfEattUCHb8zChL8crnX0CCw9MiN/ryfs9PXXK2qP3lFU59GUHd9q\n' + + 'Mz3RQwF76M9C8zbsoUymIPXUypBBma/qsF8MK54qYoVPody6T3u7bEfW6E8r\n' + + 'nDtlz62+G6wk4sNE7iJsk6KhGmb1t9v/j1qgmJwuE7zGP0QjSuquJsfkzUot\n' + + '1eU85XnUTGdoYBR2u5F2TsjIHn1ex2R0sZYfdc9eRNSSvDHrce9m7R5p7Y5F\n' + + 'sSs96Skx7wLuepGt/vY2cH9Mq3AEGaXREV2NSr453+gHeTupp3aIiQ2CDpFB\n' + + '/MzSQAHCPW1DUf8r1cFE1Y1RXU15gNBeFju/ZBnpDlTbj3xXi0shafcl59pe\n' + + '0LTGhdDSYPX0Rs6zqJgex20XBnfgPD0=\n' + + '=ycNl\n' + + '-----END PGP MESSAGE-----\n', +signature: '-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7fQICZASd4ccCgkrMhYhBGLo0VO3qtKBG9Y0eBJ3hxwK\n' + + 'CSsyAACktggAr3mI2uwn4m4sI7m8A8wIRgjs6h8V7d2feLsdqV7QL6aUzYld\n' + + 'bewZYKQjSXdnklRtnlCIG1jmqFOCycv++3O5jcWY+du8lR912Gkjn0PDN/wW\n' + + 'jSBDTkH0IKmIrYqIDnfbxYoUfUxAWXzm8N0LgVnA+qgs1CYzcS8S38zAONvH\n' + + 'GBl8ZXNTgY5HYN3Pk74wms5jhBF1J7mtfMCNN8k7VHFaoC6YVF1REhwrSlxx\n' + + 'l4bajYkJJMWfKdiQWQ31kSHChzKXBhu2rIWJ6A7ijyoc7Ff0s4xgwm/3cLQc\n' + + 'hrlBpkMKI2xCDnP10Sr1sgmG7ropd+tCOFwsoEWqFqt+kJ592+g1mw==\n' + + '=TVDb\n' + + '-----END PGP SIGNATURE-----\n', +sigType: 'pgpv2', +verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7fQICZASd4ccCgkrMhYhBGLo0VO3qtKBG9Y0eBJ3hxwK\n' + + 'CSsyAAA8/Qf/Qvcom0DtPUQAOWkM+FCeBttjkCiM/ekZa1Gxioyy7jT0Baoi\n' + + 'oUi8y4BpmjKjCvUGCDovcvvnjeLW8gpqunN/LOx1c4mPsgFTU0IQFqZmTtZK\n' + + 'KMa+p/uiTXNnwx9635FV8WLOWQoyJP+u76rTu8n2YU1+5+N7xan9Wl+yuu4d\n' + + '/WkFwAq/WQjW4cgIZ08OWfNGaOh6kt3ceCvR25XVbb8gdMPOj262d7RuWVqs\n' + + 'L31XJ8U/EkKZN5AxIB7AP6HKhZhlV6qbgizVFskWefT4E3Qq+9WLn4ApHf2R\n' + + 'OksjHVbukZNbXrWeMjbZE9RlswPCXM68WsxWe1zItjXs63w1mwoQZg==\n' + + '=e9QO\n' + + '-----END PGP SIGNATURE-----\n', +link: 'bafyreiewla5iyd7rnvjw2c5w6dbab4zkyf2desbowzouijoea2jzakxz6i', +cid: 'bafyreibhnilz634i55hdkrkp3j4vt76dnyegvmrezdiuykeizq7unvx7cy', +messageCategory: 'Chat', +messageOrigin: 'other' +} ``` -**Example NFT user:** +| Param | Type | Remarks | +| ------------------- | -------- | ------------------------------------------- | +| `fromCAIP10` | `string` | sender address | +| `toCAIP10` | `string` | receiver address | +| `fromDID` | `string` | sender did | +| `toDID` | `string` | receiver did | +| `messageObject` | `string` | message obejct | +| `messageContent` | `string` | message content ( deprecated ) | +| `messageType` | `string` | message type ( deprecated ) | +| `timestamp` | `number` | timestamp of the message | +| `encType` | `string` | encryption type | +| `encryptedSecret` | `string` | encrypted secret | +| `signature` | `string` | signature of the message ( deprecated ) | +| `sigType` | `string` | signature type ( deprecated ) | +| `verificationProof` | `string` | message verificationProof | +| `link` | `string` | identifier of the previous messages | +| `cid` | `string` | identifier of the message | +| `messageCategory` | `string` | Category of message ( `Chat` or `Request` ) | +| `messageOrigin` | `string` | `Self` or `Other` depending on the receiver | -```typescript -// Fetch user -const user = await PushAPI.user.get({ - account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, - env: env as ENV, -}); + </details> -// Decrypt PGP Key -const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - signer: nftSigner, -}); +--- -// Actual api -const spaces = await PushAPI.space.spaces({ - account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, - toDecrypt: true, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, -}); +### **Accept Chat Request** + +```typescript +// Accept Chat Request +const bobAcceptAliceRequest = await userBob.chat.accept(aliceAddress); ``` +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ----------------------------------------------------------------------------------- | +| `target` | `string` | - | Target ( For Group Chats target is chatId, for 1 To 1 chat target is Push Account ) | + <details> - <summary><b>Expected response (Get spaces of a specific user)</b></summary> + + <summary><b>Expected response</b></summary> ```typescript -// PushAPI_space_spaces | Response - 200 OK -// Array of spaces -[ - { - spaceId: - 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', - about: null, - did: null, - intent: - 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A+eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868', - intentSentBy: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - intentTimestamp: '2023-07-12T01:11:32.000Z', - publicKey: null, - profilePicture: null, - threadhash: null, - wallets: null, - combinedDID: - 'eip155:0x12E429E3672a02E385F9f5F75E932cC1D566EEea_eip155:0x49D407CC9D0e966CD9B22BA40685083B49bd2315_eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868_eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - name: null, - spaceInformation: { - members: [Array], - pendingMembers: [Array], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: - 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkrksbCZA3GHnYNke0AhYhBNp+D95LDfs4yU03LzcYedg2\n' + - 'R7QCAACRdAf9ELAnCLXfBiAVdbgwj81xr+w9Yzw2wXLLrPLfYY7EXfyChLzQ\n' + - 'rr9XBDdWMgtzEU1diSPMbLDh1METR7n71EjG0AoeX5A2pkHI7R1vIxXUJR3G\n' + - 'fzHENsfGaKLnhrL1wLjBQACzEsIqPrHl9RItdtKEs9izLmc+wV0GFJ5OjbAs\n' + - 'ty/1Q36nnMB7sQ7Ytb9Op+q0TtZPZ7jF9CjX8KGav3P1xDQex9nfsXiDHlLK\n' + - 'MqDePaaMO6RJUWAP2xTo2k1DDJQ2dpUhs9XyjMlvFhVbIcT1/lVRCPC8V3C8\n' + - 'fUKhUejvOjNFxf0QuR+E4xs+Q3zvR1+fXdJBxbH2Fp3kOTN1N9/LEw==\n' + - '=sLLC\n' + - '-----END PGP SIGNATURE-----\n', - spaceImage: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'statutory_amber_roadrunner', - isPublic: true, - spaceDescription: 'continued_bronze_pigeon', - spaceCreator: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - spaceId: - 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', - scheduleAt: '2023-07-12T06:51:32.000Z', - scheduleEnd: '2023-07-12T07:41:32.000Z', - status: 'PENDING', - }, - msg: { - fromCAIP10: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', - toCAIP10: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', - fromDID: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', - toDID: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', - messageContent: "Gm gm! It's me... Mario", - messageType: 'Text', - signature: - '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkWKQWCZB7dzg7q3axjBYhBJFuYslzDGbuE+3FMnt3ODur\n' + - 'drGMAAAjtAf/TXjtm2qb6aSikFPKYXm0Ekws+65fisJGf7T48MYkkfcD4t2e\n' + - 'HXd9LtohzGhcztbOQfAND3yME1GWuMBIksq9rlyEA0ezwsGzCJVhBnkAHBe3\n' + - '+1v4/mNSMmInU8y6sOiLiOcW7ameJvZvDdPDJ0YHhc9dKDCIh1UAZEPAgx+z\n' + - 'Wc0DM6pW8bT70dfgnuW2LlLGF5Z23Z1vbHmeszt78+xYY3ez/hoMHXUIE25z\n' + - 'Wrnt75nasBBahtJ0mwH10ATnsQNE9hTi6XPGYxRSNDM9nyRxTQUpjhNmGS/+\n' + - '7oFyq8xTcRSaL7d3h8URp9hgFWher5ZZDyMV0jvk+HPguUX54g6Kgw==\n' + - '=dcRD\n' + - '-----END PGP SIGNATURE-----\n', - timestamp: 1683530775648, - sigType: 'pgp', - encType: 'pgp', - encryptedSecret: - '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMA9aU+JGZVRn/AQgA1pIJHyeJinU21r6At5S5ZaWeN0OEKVB2TjpqZ0IW\n' + - 'lHLKQrQ8k3M16bN+Vf0P+DzDVOL84QRkBD56qSNVHOOCox5wcQeR01CczenV\n' + - 'LUVvVjBzR2hj7Sdw+Q+M//rgeZPPUDbNyiVmGijelhwDqWd7IOoZY26AGXlm\n' + - '7YQiElvHN2HcYXaTlLAOy36BcccwHu3Tn06F77ZXaf8FnGMWOUy7wh1/jugg\n' + - 'D17jUZGLYbmw+u5l9BOfljbw2pb4vtjWht0I1b4GYlKb+bYg/NY0UNsq7mSh\n' + - 'dGAmOhy5tC2NMjLRRLfD2qasxHoHN50onlB6HcYLl0RCf31ebOgO6rMhUnxt\n' + - '9cHATAMLWLG2xubrYAEH/2tVeq2j7nJALGSFxjJPboOY57aiFrhXNQ/e/oXH\n' + - '//TNJgGWx4Ta++OuF2Oexbh9DIZhl6DWld9adXDDtBS/fEyjNsYqwoYlNEJN\n' + - 'kLvSmokNNrE4MKC1A0GkhSh2MGQDNk42GSgz1tep8XSVc98MHqfNXCHVb5Oa\n' + - 'OBeWKLFyElT3+KuZxSkCsnoO5YjuCGbXPyG06tXMHXMTncpj1ri+vpjUSnhD\n' + - 'wn3o0zpNWu0GaWXIgTqj2ZouVwV2S1+wAJQjE8uI1JvBiMhA+X63/GCcApBu\n' + - 'C7rN0Cs5NGXCn9VWp8i1SCp2NuZ38POABwsXUUkjpF24txyUDX8dbXlkzpao\n' + - 'g93SQAElYYmyKbGp1TKhAZl2u40mgf2yCYDv2DLRfAKMJDLvmjXoUGEg2UYO\n' + - '11w6LD0pIykdKJmFtRls/uMnlcoBgDA=\n' + - '=kzUH\n' + - '-----END PGP MESSAGE-----\n', - link: 'bafyreib34jgnpp573rwquejcq5avxvydis7fbykat6dd5z7uazobucoumm', - }, +// Combined DID for Chat +eip155:0x7a38D295786d1480BAab4a63b8d85B5a47bA4b78+eip155:0xcCC0Cc5081A135E4269E82907d2dAD6728ea4159 +``` + +| Param | Type | Remarks | +| ------------- | -------- | ------------------ | +| `combinedDID` | `string` | Combined Chat DIDs | + +</details> + +--- + +### **Reject Chat Request** + +```typescript +// Accept Chat Request +await userBob.chat.reject(aliceAddress); +``` + +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ----------------------------------------------------------------------------------- | +| `target` | `string` | - | Target ( For Group Chats target is chatId, for 1 To 1 chat target is Push Account ) | + +--- + +### **Block Chat User** + +```typescript +// Block chat user +const AliceBlocksBob = await userAlice.chat.block([bobAddress]); +``` + +| Param | Type | Default | Remarks | +| ------- | ---------- | ------- | -------------------- | +| `users` | `string[]` | - | Users to be blocked. | + +<details> + + <summary><b>Expected response</b></summary> + +```typescript +{ + did: 'eip155:0xdE3CA2cC2c91Cb9B3aDB80ac497662Dd9E57BFaA', + wallets: 'eip155:0xdE3CA2cC2c91Cb9B3aDB80ac497662Dd9E57BFaA', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGT29asBCADVtp8rHsmtqgUSHxutStJ8AO78jWFFerHJQQ7M/QRZ/1mg\n' + + 'uDTt4QTsmhNPlyzQ/OztVDOddn3qqZg4/gLUpJclMmR3UmxmTGrv9PaL9IOv\n' + + 'otdKrLlYKeXUHbaBWVgXHv6F7hrCx1Faiq4I5Ca8tdxhKyQc9WAA4f7TTxhg\n' + + 'htDY3VfRnp1LFlXyx8GyqCBGpmQx3tSK0w6SoC0FdCq/DpaXD6ofIKH8kcjJ\n' + + 'vpBXw6MLwymZrfzbUtYWykOZ7QWgDWF6Y0xjDjZvlajGeY7NfciQR+2ylb1r\n' + + 'eOn1yGN0Fvw6+7gGZy85XaDoCnyDAws0Nn+2G9BqTKVH0UwweWKcqOtbABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZPb1qwQLCQcICZDxpr16PpcWmAMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBDqZlQ8vQkW6qMko3/GmvXo+lxaYAAC9AwgAy6nLLykcdRlW\n' + + 'dPXUN/wTqowopbuRo5bMhz6+Q53Hf6qkjfknaswoBtE2bq/J54N0BN70Lv+j\n' + + '5klfjZWJF2stgMEyQfPbXp1yXQi9Rlmvg4qZvZRww5UNm6CuqxU/stXQK/Je\n' + + 'N9eIqd+fTB1EMKwbFrFHfOSKWK7OGnb6fi6JqofJcGvA0Oj1Wkf3i6UohsZL\n' + + 'XE8L1Ku2IXc4oUZH5UZD6vRYkQg6/EGq+WrHUXX2nifdK5b5tGZcfGe6Tudm\n' + + 'KeYFGTGfgbA8ag67nD4Esr296Mjjm06TTvqdo2r28/zn5KcRPWtHNpPU+t2u\n' + + 'kwq7UBvoroACgr3yZkdAFLt9E5NRTs7ATQRk9vWrAQgApfSeqUx3ob+kinzU\n' + + 'opKC8L9qV6jqkYu80coITufcc4TUEYlNEZwSaMRA+vOk+bwWbc+zJG7zW8aq\n' + + 'Tx0LyZqABgRsWOsNblepCzyejLmAwxl8kBEAMQvJ4Hjo55MGEjfsIFSqeEGt\n' + + 'PkPZBpxYN0/sB+yYZDt+59L0GGLC0vrxvj9aLw1xRaTNCNLkawTa8vTCwSTY\n' + + '/833aJy6kevAXzj7V8hOGnY5JU6dx5Wbsi1HmzuhtW/lG2n0JtYokfpESnQ7\n' + + 'La8I9PqpJC87iFEdt7MST2x687sf0vJI/QMRQ2kZF6Pi8LRYuMmrYTF2BIaH\n' + + 'kmPafAoy8BYNfetl67EArGHckQARAQABwsB2BBgBCAAqBYJk9vWrCZDxpr16\n' + + 'PpcWmAKbDBYhBDqZlQ8vQkW6qMko3/GmvXo+lxaYAABjFwf/epZQQVs6w3Fj\n' + + 'JV2OhS5PYsNr7hWAgAVTgqBLOuPkWG+yfwmayqyQKJmr3a/e+1wKC+Mrz1D7\n' + + 'cRpyiwyiCp01has6qMAledjGweg5wTz4axMSQn/KsLc7dsLOtccV05RkRPMZ\n' + + 'vRDDJkfIVYILBikTcg5WEIulGuy7enQO+Mo239WrUxi2QjAkEMt2pxjp4qNM\n' + + '9vMEPo8uUiEj/+Tsq15kbE5NGpL+n69R1/PYpHp6R7acimsZlXqyhUVaTD67\n' + + 'QDFLdR8nVToU2ACOvmJicTVHCiDbRfeUgMaaTu45degUEE7rbh+dNiJrkyFh\n' + + 'GCHIKjRcKEpModMxiZSJBINcWI2hlA==\n' + + '=ktHx\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + encryptedPrivateKey: '{"ciphertext":"5d3b651b63db81767bd7b9387a085c0134a30d2c77545b4db528c15c429286620edf527b069d4f90fb7e7e769c6a0fff19f52676972765881cbb601e78f386cc492b6ff7a4739996148904dc09f4f95ebbd53ee4e0f17d17dac66aa5b11e09daecf307b120f5d1157465ef15114b0b20642d7b64d45a218307764bf48c819e05247db0d782745d458e5ca574f92e0479188d5ba557201d58d85753f2619fd1648a80f8153e4847b7fa455e50379b096b4e430fb49b3084441a08f715f3b99c722e5a6b730ca8c2160075594caf3fccc26bc9289c116751e4e8306cf33b96a60bbbe46bf4363dd3b25529ced93c67ec60a153331fb340d2344851ace937dc161dd9aeef20dc71a6afd7cf308d8f4c05e9c779bf5d684fbc4620b955b0aaa80f89287c197f2f4b00b5450b55770ca1d44c8a78583762c3740dc88fe122afbec422e64842ae9719d21334d0289718468d11a3cd12373583488da7631f924c9f1566c6eaabcfc9f146fa50e49986300f7e7a3d36d0056c381f6decb38b10ca291a747deb0d896168fee9279b5bbd0ffb7aa419843d1f69da632552aa885ad694fe8ab50fe0bbc79ca4980e522d4b001215bd267752340f02270d05a5ad8673ef998199b1b0e6930cc53c97a14245ea5355e10a438513a94bdcab49b4aa605277ad11ba0603ac59d6f2e1068791a61b4531d55c55837bf43299524e5c4ff454631eddcdab0f036b70985e49f155bed3bbbc36f9e69b6c411077051c2f3083354160146336f7d023b51b8091b32cec3b0d8e5dd67f3796e00472d1b305ad3f861b6ea863deeabad29bac8dad1ded1a59fdd965ff5903c7dfa1ad956a4264e2227ffe9bd9e15ce7eb48c0a6494c07a95865770adacc94703c19f4c1aba9bf885d6311490a285d42a6e8899de07709e176a30dff3e8988de3f22188d0adf03bb633607ffd4daa503b7121a5e5c3946bf3a48d62d511cf5518ad94b43839827af07faf9037bc959a7ef621df75ad965045dba6c89ae255d200ebcfaa0a2f652ffe630df57685eb471c4b089ec6e7d4c841f1e2e25bfc3b852cf79c4fdf66327a18302fdc10c6f044e42387bb89c45644643546e93324b8ef4d7ddb6016457f5098da369915ac6e1d2ef45fc9155cf13d165d7822bc6e463932cc69ac7b372a0e3b18c45b45bd275b38af4b29d665856dfbd6e6c6ecd9b6d02f4e61308273d76ba0baa0eaa03ad831adb428ec70a1dd29b3b2c4941adfddaa76ac99c47bf6eef92a361ab890c3e9bc714263a4f93289cad7344882886aa101685586a54e5da7d370449b91400e48c6a1ae8f6e2bcc06fe186d981399c28143a3faf1cf2c06342b82382c01096ff8542ef55c24175d052f199fe39a4ebf39c56bd30a8251c19745d1b9d0a1a96d81e6cff3c060d00d85d627a9344e1ae98cb42c1f05cd2dd9ae3d83b7974a7bf96980c33fcd76f96ec6c2ea11a2348026333424307f1568e5aa575c31f819260d52ad968e9a17cc46723ba1e129614d2a47ece4dde0e0cf4bce2be7ab25441255997d8bc659a194665090baf6e071dd4775b2e2f7974d26e0cd040df9890ab58c77732d6e33a8ce909e965c2f04a7f65ab5331c044cbbbe39184721310235a772b30a30071a8058b9941f42d85c2e63bbfece7d6116a507bf1612194ed17f430274e4053d2b8de761cd6c316f08c401c66f1650d0e83fcd0d69dc92763f8202748d8e40bacae6cfa264d8ab19ff86e1753d3a33c3ee9b4b9fa6ef64765e9d2b2ba52b28e61743aca96471e6c35143ac8238275b504e7d0ccf0c9cec095d02259849b5f382fd7eb0b7fa3ddc0c5dd91cc2be7829948852dc740d9227f17b2f960141f4807678a2dca6ee24a858a6f20874b1b8e35305106c77c38dbbe52d3e533a845dc8a0912c7d95218c6b820384de5c2693447529522df552383e35d126122801008aca30065c8f93c8556ceb09f5512e64dd481d5ae823675c201124759a80477b1be6ff4756e94e814b279f4de19b79a72acc52d0e1d1e9119abbcbaa1ef0c6dd50894db4ee5f4c005658416fa840f19e36b65c591e73ac8ae4d9e49ac13dfc40d754cc4f9eefd327876a94e5a72f6ebcc8bb4645f6da8a7505d64190ef400829be6455737fb60d595ab13cc9d8634514675803693402570ff869858943c4cfaf914402153a41bcbf417be30c8220ff994d48d85a2893991a5241d407e6acf8341d11bc72de3967720238b218052580d121c6d2d01e788d6cfb2bac26ae205e0e72198c40418bb6e3f25f0e14f03d237bde9efdccdcdb2659a40276ac760a4eeb0770bdff49513b88e51a649bccd82da5c82e6c50a91cf9145091f08bacf7aee46e80bdaeb320af371d6e6b6bc29fab41df2c4f09953c0efa3b92f0745c9480536680d60fa0badaaed85b8836b5e5e54c5aebfc99e2a3b32ad3a5c882829b55e9d80a33468b05e8196c408a9de4a13af00df4c9b632eb4d04372c99c8020fad56383cd4937088d2fb4e7a0c4edc15e3bd79214337e02fc72cfa703e12bebc396068da9eb6ef142a55f6eefd8d11a501c4c6610c808a75923e2b279a2809ca34c2da49731ce85756a7039b667cafcb081693375f4cf8e1b39aa5f29560d7ca003775ad5affc621c359198a4dfe484edb11853586c1c664459c996457454803fee7350786410b8b9d81bc0e31f4426760ef812ebb49b1a63612c3c3249a0dfea9b50b620a818654bc18bb3f411024ef9ef7fa21a494f359473bcb30c70070b78ea9106d5441dd89322ee2a31c945b884ee9008841ca8dc776aaa6c46526e6a21ead1831b20697b75905a13dd947ee53e6a105f0bccb3184f679b05c475f5294d96a16fc50dd9430967a1c7013c054f3fb0fe07c586c5835b048238fd1effb7bcb6ae6da40883f387dcf684ac20709c59a312507d125fbb65208a985f0a6f5e2e442330ce39c0503d27cd32d61541f99e1d20b2314e830f3d03918be89152a0547a45ba0a419ef6beccb83b444c8081fd12c79f8d88ace21c9057265b351a7ed8588560a9f549149b1e2fcacf99fa6cd045462122a4f60d969fdc7d780465349fa359c95a5b58a9e2b751e45301696407a1ddd17c32dc7bd5acc3ce09ff5ad20b9d91a9ac8eb3d142bb6907f19b789cbbe15a2a34469e90a652e5504228f12411a4ef54abc1c1d9a132ab85e42f1dbe2c14eab46532f22fbad0e912911f44510c10569a99a0a99f774070178776a970d83bdf50257cb6ba08ba6561b16535b1e05c16a06bf0e3b29b082f66b8336e676cb4c6e9bf98362b631173f683d251c4866e49860fb83f4053087f44c033198397ffb69b7053746ba150e16399c2f064967334f893125de76539730211f8c6edff3108db2c7e8641fc50ccb9946596b59fa425265ec86db50414218b494b5166399209a1d664d2157da0161d9786396dcf2d91f9433d39219d35f6974c96e4f1bf5f5e0a17db196e97dfff13e58131ffcbe3a8a647cb6a17754657b93e9b9cb458b9bd1d8cbbde72cdbccef7073ab2c290e237423b8053a5cbf358a88d1101e1f648c392c80704c7dc9d0509e186a11a9d90e9106bb1fee1883af0daeed804702b9e2384ab0c519129ae330914ade6c5080f6a2d17b716f71d81c352c07c2cca0c210e0d951b0fefecbb00ff0c3693fe262cf9125094b46329eed041d3801025ebb67722659b98d3e5da83ba5343a058540e868742ac36c852f26b3310bd33af4884d3e51e046c0ee17b714ce1f29df6442468791a469eb1e387cf9d366d24b00aec6a089a88c96a82a1ff71b1947a24015b1cc13be259be5bb75731a18ca58aa46609e2a2ee9fe0583588f0c453a2b99166831669547428941bda9a65ab82462de8add40f16976a13e36a0018886d27b4cba663369d13fb056a874f6d5e0e9ee6567ce7428d9e179790b44649a05aa8523fbda4b9db72873e9aba33892bc0677339332d5da9b3b4754e2b387597d8405de304d8b65ba6bba9b0558457431820582df5ae3577efba787ea3b4eea2515cfba590c7821d2d47ada99c612ed4e3b9d3ff9ced63e76379789da562f45f851bd10e8e6d2ef633984ef4bc6bfdb4c833175448c3c6f1f7735587b6e325866a21b8d02cda06e9520d18350e38b428b3949635dad18cccd4d840d9e4c872b32c527d2f521de3822565b7af6f5d8e254bc142029faa91effaaea2ce70de748eae946a2521d3b5952d5874e5bd6c4322a35660b51ff114d5cf6c5b5fbaacf834eb1eb68087ec06668dbe804d349b1d5bd3396099f3062982fdb9a6afe542c8529752c728501ddbed65a210a28f351f3f44ad40d3a6ce4995f2e6da7495dfa40a4838fd2d808b2e298a863a7475c2134a713cfe8a47fb5bd479891c2747f0db0005ee4a894b6e8b66cb5e1af8d938fb1f5f53c24aeacbcf25b57b83c5abc3a1adbf7853e0a6ed5904e19d5d824b1500296550589c4a3186359b72a1d482b02dfdc1874e64c78a9df7097696457832d6aa572102000c06af444c8ab83e6204ea920a2a847cb163efd9a4701148b4009b2f8053bd7d6408045f627df3f45b002d249a20dd829cc8ba18d9c468d816d451b7f3792e31f360c5932656aa7bfae55b75ae0c40af53ad33005d065d047926543d68e9548c51c3d5405a164b902825fa5ba8c8be5dbfe8632a94df6ae322425be86df9234140bbeeb707d45dfb4b64a09925499ddd2192ad1174776f006f3e91627768f60be59756b7a9b51e4e4e02c01a7fb8b06e63dc3e71951e0b426652b1796bf546da832ae70b055a4700b3d6e266f4af898f0f517277db75aac827d6c30f75c6a6fc9fe6ef67e6f3fbf9c21f731f1f5d89feeb1a76c7ac9923320eb56c517f937a32f3629a8fb4f134a499562f837515596508cf6b2ff3de5c536dedf2946b85505c5843d09bed34","salt":"7b0c5813b930a5ab6713f1572441734633ec845aaebf526f1daafbf89ef268c4","nonce":"bf2c1e6312caa6a32e95eee5","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"fe71bd49335560367aee6772233e69316de48378df6ed104647068e8525d2c4e"}', + verificationProof: 'eip191v2:0xe58171978843f55fda11f3989ef8a2310a3366585cf3ba6c71dc260e362bea1b2b2667e287959f6f79628a03073d5757011b7161a2782c32290f924486f87e0a1b', + msgSent: 1, + maxMsgPersisted: 1000, + profile: { + name: 'Bob The Builder', + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA40lEQVR4AcXBsU1DUQxA0RvrK3JJReE50jADEpTZwRUbsEIq75AS5sgcnsFKE1orxUMRSD5n9/n8cqMxV7qMojNXVjKKzlzpMopOGCYME4Zt3Mko/lNGsSIME4YJwzZ+Ya48wlzpMooVYZgwTBi2ccdcWckoVsyVzlzpMopOGCYME4Zt5spKRtGZKysZRWeudOZKJwwThgnDtoyiM1c6c+UR5spKRtEJw4RhwrDNXOkyiu5yPdK9fXyx8n16pzvsz3TmSicME4YJw3avT6cbzWF/pjNX/iKj6C7XI50wTBgmDPsBSK85Mi5fmXwAAAAASUVORK5CYII=', + blockedUsersList: [ 'eip155:0x30d45C4aAfDB894Dc529aE15e7A55fCf49184eCf' ], + verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk9vWtCZDxpr16PpcWmBYhBDqZlQ8vQkW6qMko3/GmvXo+\n' + + 'lxaYAAADJggAoSO2WXXxPtkFBMcM2Bqc9pzBFkklicmWj3Fjl+6FB3sDXt3V\n' + + 'YGNDqSruqpqoiCpMATy9QC48zO9Bj/gbIzuIbLRvNs9M3D5e0si4/OHKIbSX\n' + + '3dBiaqaLdki7tUvtPioQ4Q1ZkdOATr3Wr/PyrHc0V00fE64qb0MlN4ouvYYf\n' + + 'yG4WK/0x0iH/RPRyG60fkrsmZa/PPpRBzReZXwrsVbBoOCBSe6f9s3EYTfim\n' + + '4ThX4zrbwKXx7Wgv1lXw386jvlaqUze9A14DAq6OjwqAZEVmLZaq6r/OHmqM\n' + + 'Jy4fZI2auG9uYDorCxP7n6RjOSEOCLG8k+WRDFn6LSPJpdrYoYi6MA==\n' + + '=d+/X\n' + + '-----END PGP SIGNATURE-----\n' }, -]; + origin: null, + name: 'Bob The Builder', + about: null, + profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA40lEQVR4AcXBsU1DUQxA0RvrK3JJReE50jADEpTZwRUbsEIq75AS5sgcnsFKE1orxUMRSD5n9/n8cqMxV7qMojNXVjKKzlzpMopOGCYME4Zt3Mko/lNGsSIME4YJwzZ+Ya48wlzpMooVYZgwTBi2ccdcWckoVsyVzlzpMopOGCYME4Zt5spKRtGZKysZRWeudOZKJwwThgnDtoyiM1c6c+UR5spKRtEJw4RhwrDNXOkyiu5yPdK9fXyx8n16pzvsz3TmSicME4YJw3avT6cbzWF/pjNX/iKj6C7XI50wTBgmDPsBSK85Mi5fmXwAAAAASUVORK5CYII=', + numMsg: 1, + allowedNumMsg: 1000, + encryptionType: 'eip191-aes256-gcm-hkdf-sha256', + signature: '0xe58171978843f55fda11f3989ef8a2310a3366585cf3ba6c71dc260e362bea1b2b2667e287959f6f79628a03073d5757011b7161a2782c32290f924486f87e0a1b', + sigType: 'eip191v2', + encryptedPassword: null, + nftOwner: null, + linkedListHash: null, + nfts: null +} ``` -| Parameter | Type | Description | -| ---------------- | -------------- | ------------------------------------------------------------------ | -| msg | `IMessageIPFS` | message object | -| did | `string` | user DID | -| wallets | `string` | user wallets | -| profilePicture | `string` | user profile picture | -| publicKey | `string` | user public key | -| about | `string` | user description | -| threadhash | `string` | cid from the latest message sent on this conversation | -| intent | `string` | addresses concatenated from the users who have approved the intent | -| intentSentBy | `string` | address of the user who sent the intent | -| intentTimestamp | `number` | timestamp of the intent | -| combinedDID | `string` | concatenated addresses of the members of this space | -| cid | `string` | content identifier on IPFS | -| spaceId | `string` | space identifier | -| spaceInformation | `SpaceDTO` | all space information | +| Parameter | Type | Remarks | +| ------------------- | -------- | --------------------------------------------------------------- | +| did | `string` | user decentralized identity | +| wallets | `string` | all wallets associated to the did | +| publicKey | `string` | Public PGP key | +| encryptedPrivateKey | `string` | Encrypted PGP Private Key | +| verificationProof | `string` | Verification proof | +| msgSent | `number` | Number of messages sent | +| maxMsgPersisted | `number` | Maximum number of messages that can be persisted | +| profile | `object` | User profile information | +| origin | `string` | Origin information (source of the data) | +| name | `string` | Profile Name ( Deprecated ) | +| about | `string` | Profile Description ( Deprecated ) | +| profilePicture | `string` | Profile Picture ( Deprecated ) | +| numMsg | `number` | Number of messages sent ( Deprecated ) | +| allowedNumMsg | `number` | Maximum number of messages that can be persisted ( Deprecated ) | +| encryptionType | `string` | Type of encryption used | +| signature | `string` | Account signature ( Deprecated ) | +| sigType | `string` | Type of signature ( Dprecated ) | +| encryptedPassword | `null` | Encrypted user password ( Deprecated ) | +| nftOwner | `null` | Owner of NFT ( Deprecated ) | +| linkedListHash | `null` | Deprecated | +| nfts | `null` | Information about owned NFTs( Dprecated ) | </details> --- -### **Fetching list of user space requests** +### **Unblock Chat User** ```typescript -const spaces = await PushAPI.space.requests({ - account: string; - pgpPrivateKey?: string; - /** - * If true, the method will return decrypted message content in response - */ - toDecrypt?: boolean; - /** - * Environment variable - */ - env?: ENV; -}); +// Unblock chat user +const AliceUnblocksBob = await userAlice.chat.unblock([bobAddress]); ``` -| Param | Type | Default | Remarks | -| ------------- | ------- | ------- | ---------------------------------------------------------------------- | -| account | string | - | user address (Partial CAIP) | -| toDecrypt | boolean | false | if "true" the method will return decrypted message content in response | -| pgpPrivateKey | string | null | mandatory for users having pgp keys | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev' | +| Param | Type | Default | Remarks | +| ------- | ---------- | ------- | ---------------------- | +| `users` | `string[]` | - | Users to be unblocked. | -**Example normal user:** +<details> + + <summary><b>Expected response</b></summary> ```typescript -// pre-requisite API calls that should be made before -// need to get user and through that encryptedPvtKey of the user -const user = await PushAPI.user.get({ - account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', - env: ENV.STAGING, -}) +{ + did: 'eip155:0xd1790E37fe3459e3F48eEEe41a7708a3eC2148f7', + wallets: 'eip155:0xd1790E37fe3459e3F48eEEe41a7708a3eC2148f7', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGT291gBCADFq+sw1v0dNAqkG7bMUZy0tzo3E6iPZQ5UwlOvtzaen2md\n' + + 'OHOTnvaCFRjRQZjrvlmbWwBELOTsHbmluA41MeayoJ7aA+o6+aflaa6PCUG5\n' + + 'ugAfXjuQxPn+gK0hFdn6IYxvBQHdh+Hu0Obi4peol1GobzraVZt/fRrXdttA\n' + + 'tLM7EmvX/l5440xO8+kZ9/uhMx5MR6fdD32AWPpGDy6tJin4awSdTN4eIwI4\n' + + 'ueKUZ0+B4wWAiEkRwIRWY4vbCCfMeF+qNMGBaz69I+YS/2FvyqAXTkyKytt4\n' + + 'U9efp+ObJsNGk8OA2JWZE+X/16eO8xvQSHhcoH5L2ahGTmG8+xr8bFoRABEB\n' + + 'AAHNAMLAiQQQAQgAPgWCZPb3WAQLCQcICZDzsIc63rzcLQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBLvWJU1IWhvs+frC7POwhzrevNwtAAD9Awf2KFgMZaNyYeMO\n' + + 'DNojkd6YpwtXGp4zxxL4JrZwDBginbcba4oUyTAqIcJWe3BAGPXX4hi3AYjE\n' + + 'BIERstIeb/YkcTyRgyZKDj7tDNPF0itxfiUXAETN7Z+ySkLWx+5rQ8B9VQv5\n' + + '0PLDDwBfwju2pp1/j8XTx/81PSjVKpFQoEsEPOj+WloOdonzx+SGcr5mjjYj\n' + + 'rR9NpHVUxi3Xx40zJVVqWFbTdnqd1Wm5SGkrRWLJAe1hzHhYxtpEDGqPfxYo\n' + + 'bBMe7bphBkh4DYWuemj/2PiZaS8NC1ed32YOwOSWJV+9wmUvIvq3Q08AE2yF\n' + + 'tfeNnX6Gb6fDgvPa3Y1Qg/0S3wYvzsBNBGT291gBCACqFMmyuJkBkNwwpNE1\n' + + 'L1bJLulRqEm/tCZ2HY58G9NGYgo6u9Ii8H+ia42bf9Ezq4fLBDzYH0T6Pe9Z\n' + + 'zAQHudpId8SNfT15QdqYvHjovxk7jqucF/+W7+DilPXZn6eomrOKePCNP8Cg\n' + + 'JXSoShkVaWkbkr2UkHGpcU7YIvooAtsxXMWWr1Z3hbk7tCf1uwXV4NlAGIXx\n' + + '7FSvWuQ5ow21GqM/6HyeOzbJRis0DNV5NHY6uUoFNUNzPPBBYx8DRDzjmmde\n' + + 'KpjialSW5QK7g8KlWaSGnHFCd6eS7pHZURl1l299ONNJ5m/B9yibBKwHCQ3r\n' + + 'V/8ByDlxzjU3wbgdZ7+LfjitABEBAAHCwHYEGAEIACoFgmT291gJkPOwhzre\n' + + 'vNwtApsMFiEEu9YlTUhaG+z5+sLs87CHOt683C0AAGnNCACtFS+hJSnqZDmf\n' + + 'XGSIw3FLkD7OsaOd/75BZ+cqXnfE4is4JlN7IceOHb/9+UlghAOfpjJYfn3Z\n' + + 'HobaRnUZTm8unx0uVQZ4PEZgPGuIKjnwmU75xZVpYegXTE55faiDoQZp0Kir\n' + + 'zyScqaIuxHGkuW5Ii4hcLXKBK5qKv8cydeOgZU4NJ7jb8DMQhWulx4PHOaMk\n' + + 'JR/sRVuzkxfZQ6LPtnWoTmJLr4wJ4WD/nM77W7XmO8ZGoe2hE5V/OZJC+0uQ\n' + + 'OPK4S3YmXcBZoz8L6/gdUQz6kaLtRzsP7vZfyn4jWhlbfad1R7KM1srRT+OT\n' + + 'HDPpdh1b+4npYo8iTcJTnANQ5oAm\n' + + '=rs9R\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + encryptedPrivateKey: '{"ciphertext":"4bb789bbdaa33f355800c4b8d14e75f310050a0269961b1f4b64c820756ce3595ac737fba749f0b268c418b19cb32f5ccd476bddec8d252ea4cd8e7cf15423a03cc00e9a2064e4134aba89524fe2018fb5ef6b27024a4dbe519883e6f41b462608c33914e129fd651e88d0f14973b3305f8e9d1e3d95670263b1b36921a1b5052f43282768a7210c7b66d5f5886359526cb56f48c61fd3cb165ba15b36f47611d1af8c2aa6d34eec0966d1aaa5522bc2291a5a962585218b4cca7a8d4081aed274ca8ceef95596583683b212549f0568a78b9116a4847d94d32488a0c4ecb9a9b5045afcebc9bcf9d3406fbb4d7eba89f21efce27e3ac174941768008f9d67842efb65e1f3f658a9b366c5c164b5cde2c2db442421c39d46e6017be35bb5b73b06a1569b35e8c4814e0edc1f1be46a964b5a4d9a8245694e530c43e9dbfb9176c41731b315f53b46138c270b6faaec8562abfdf7b595284de89d75bfb87e977330e943788ff914636a2cb81da54dcbaaaa39bd06929020dddcd3b628c44a91a3985f527a9b4592bda19aee4da3e3ee6bc73f98d6de843315476b1f67f8b8174db7b985b94c88c0686b4fd42b45ba398a46638b8d0cde5caa22f45fa51c749377baf35358ee2c1c057dd85b550194f4436af0a43c7c5f36bd7620f28a5ccfa28f16732a4992ff9345a863f1a8f48e5312ef5927b2af2890fee50ad219b43a88781e4b007572e4b7abf5fc5b41e3b944bb164f6c9a397495c46da239b0d40aad8d5bd17a5d02a032212f6495c2f4b8287a0e2d4b7a7d4a56114becb7a26e87233ec3201c558e6f42bc74414b34ec39ada6ab64f7ba9c47e0ddbbe5a622045b236b4a137adbeeeea3559b7b8873d727f7707f75a60a3310a54080eb00e59d6fce88ffd079ac9bf3c85f4fcdb56355bdb8b0b844f42526f4b624591a1729d5b7bed31c1affb0a95266e1092afd45f5c2466a2a7234f8481b8526180ae854e6b9b5e2a2835aef5dfba36ede0c01a56eda4aea27dc415f3ef1440ed0b8f8ae805544d3f4e24d0c9ee8b4ed6def38c7a545cfdc32b3efcf3ad321fab80a15b19c5710198f97826321b69c7677bcf5cae6218279f4bf9192b4ea77e510b7409b31e7b50c4b2dee85857ecf42f3b12365ac73c41d7bbe0564c8d741128c0723619a48ac29760c1a9eff36c179b50e6be26b4e10432cf6b8f987838450189a9474e20bc10adfcaacd1199c026cecb9d8b905bf9a2216345ef532e7cf3b94bc6962b4ac1cf52ed86547aaac352d2ce3a294ccd7299221722cd2852b7c5120dad85e041b09709b49e29e2fa17e6e94c0a77c0508ae805f4ecd0fc70b3ff78cd38ada6d8ddb9b150677589ab5b77968bafdf9f8cbfb0c7ec85d35c004b7d74dab2b3c235069276422878d6c0967ed051b03f05ae70ee8f054eb25054ece32f548c48671aa2b0206f61261f3ce8f44e2754f505ea29d879a1842531e7f2c37333be6c34178c4ccde01fa79f344809e0bddf8aa07e4614e4ed31b4d2fb4dff0b97cb33305afaff864ded85b13a69de4b421f331471595df86e6a8a6bf0c64bd00a7b8521614d00e0120895ce81355285fbbdfde434df2846fb062d5e309fe58df0ebc568378ccee69d6f86aeaed2a65e3ff477812692316535f52b927da1ae3a3cd49ed49fc19988e2759f7252510af3d6f3b4b444d838c24df9627b3cbaef01707de84182c1440c736d5432da40a9ba9d493917c82f3b6475a2d2b82e77dc72111ed454b7cd6fe0d0b0f68512fe9538898060043dc9ed2995a1f8df00ac7b58fd8f9d169225c66b527b5447cf597a2c785b8777aeb2054e2c95106f701d1645bdbee9a1c48649e51dd7ceeb611a99cbd85f8e9f8fae2bdce1a46023eff7bf6748434117624a9002eaf2d1feee0b5d4519706a7fd04b7fa497a0f5e152d5387b010fce47b7df330c12b9091848976cc1aef5b50f93bc2332e320bc46d01c891fedce914141805e74c3f912dbf2991aa927eddec4ec2a80cd3acdb5946764ae5da7759f142420567cf51172b37a50d827e4f463c51a9fd6dd47139c8acba1dbd6036dd4ce6af0e5e37ddc6b2c37dfe3d1482d0f695268e842e980cdb2d6d3541856f7780b216012ac67363cdf9907626ac81fd498cd133150c95aa5832ad4119fbdab0bc8ac0012c7217558e52de5e9a0dc779cb7c013cb7a277849cb9e040d5b32d9c454317b59c8962a645540fa0d7ee59ce4468b697ffdd29c93d4db10bde567c9d2105553116860829e728e9510a4cf986a9857de09846fe78095a48787985ba2b95d2094798d9fa209b893e1874615b313b099550ad17f7050112ca81a8a3ef6c83f4c44a90b2ebe44c60d658f15ef773304ac2d715e7c061675c3abe58386a7a2803856009e5e8c495c7d3c97091ba82893899fd12fb127db0deb06aa5717c63a1f949b35be830c2a3f7731d3f41423aca7a3951c4b4ebc5e3d874c36b518276cb0c07c27952571691d4fc16655be7450b55b3587f0ce79695661d325bb6f736e20338556efc1191eab56f5a2479be34a4c7c8d58b1028def385eb0e60aed6b7e9dac35863aba918641eecb7d12cc55b858bfcaed15e330d6fc47c42e76a13e6671758d8f665aaea876191f51f335b48d1fca47dc3dbaf7a357eb3f1946d8b3073b925ba58b7886a68118d3fc5eea83c1650cb5842668f82eb3350efa6ae6f5002bef3c11c3e7f368489c5a93dec16b93817778941626f6ae7a14c6ce4e5512664b23845e0df4bb76aceb20931765106fdaefb0f749a5fee20cfe467b87dccc73dc66b652cf63ce97e8470b195ed7aec14a7c154f2a3563b8f5b3db7992499dc9795217be05148a21468b204cd025ead1cc1e4144728c9e910140d1d04225df4632fa71604bec728117791d4742c1e1006a0604601942f5852de872fef382378676f59fe6d704d1bd07b7ad0c797b6da17bd39d8b66f90d95d913d46686c3ce881c9136efe0445b1e87c2eb8cb2283532e617cf6a0c5f40fdff1fc25b8372c9d46295934a48ecb5d8a6bd5388b76a984d20a1934823501cc85b0b453bc8aa5a6f19502ca788f4ae5219e6470fd9cfc75a244cf2923cd05e1d9da40f21bdf3bbdeb4647cc82f5988d365dc2b4ae331db8e504cca746092c63f1e305b027e707c38e13c66f5d90553717f9f41cc2624d0c2cfbf814a2355d1e9dfeb06cee67b132425b4d0ec68bdc0fb058ce6c444fdd284995349379a2a17739f0859b7ce24e9b681aac2a78b5b65790aa0dc83aacc6607b15acbafcf7bf943cd3826ea64c765c6943fdbb11853abad1aa92aca6f34c0dd2002fac9f4293dc9cd776d882ccb6e1bc02eb1294e99a0cfadf3923fd9798927aa9754e0cc573ee57a20df72b08fd571ee093fac1cb074b9cc90d10ee909031fe0f3c0cd85f31871b7527d653f143cd71c2084c8a9d8354d98ca9e138eb9e813bb90bd71e58880f5b03da49218e77afc3a8802ae80770490233478c9ff149d1eda00df6af91a57f022e158d23f29c058c9183ee39c6dd86fdbdccc81851ad136fc2813c639e8b367dee11d7eb3efe8f57852f2629cdaa1586fd47150c8ecca8d1ac9cfbef23d2489a0cc515154a09b35717d029a5e7ff14d3969692281c71ebc1f8e21b6f77d724bfa60d75d3a77a54ff3043edf1339bc53fa4c2279c3068a47f8d57dea5481c6c1a3aea9938972dc00bf8b637dab25e7b01cffccce70ff15896e38bb160266370e58c61518b4de88ffa121d6f0c0c757c2585f89f456756176fcd2c18852b43231f9f3c439a338ba8052d1a498d92b9f329610f4a636abc3bec7e895b6244c2c013a1cb9c2661ea1679f2fcb931ab9ffc7d04674144a2012ecda09272d6bb83fe039cd472cd059d734137cc2cf017b1177a63b1c2db74c4b5a6ae9f65524b090c6857bfa9f05960b8dcbc6d4d340064ea6079cba74961dcb6a0f00b0de01863574158bc424cd3dcf14f43b067b3584aef99d5c4cd7831ed3e8608f3f31045c4c37d6b408f32d4590fef6435036164632698c880d22577bb1c521e01e96a57c5780665d97eb8c1b472f3a00c04362ce6f72bd9250958ed6970d411c38d616d90cdda53ab2a5621ad318cb5e23f923426c15c8dcf55d7f54a516fb0bf61fbca1e73ceb9d13742a200fa92bc06fdf8027f7fda8549cbc3f837cbf53f249225e2b7d11bb45f79ac946f9e236da16e080338bc0ec5cee88691dd9e5ea54c6079c325801e0ccc980443b652d8971bca1fd253f078da4390eef90d975460a1300a92936a2097b3529e3316efcc11b398ca5ca7128431f438b4756ca3f690844a4ebbc133f8ebcf030ad7839daebd8e9a10724754fb5d4ae289a9637932ae3dafc5b8d6017648305b1eb4d43b16e58eae02fb9501a56ba23f0c27bc9a800120b018cc69f1a070da2936a5af9cd25ba1aa64eae66b218c8964f2b38c371c8a25c04a353d228fc59f08602fbf74a98e61ba3d2a34a844bc829d5f1ee1eaf1bb1cacca386496e22eaf171f1145695f759062f9fa254c5d8c103ff26f1cd73b1c7fd0ced091c917cb63d2fc98ff2e1437b802fd60d6d72b146b695dc93d646913bb9ffc763d604ec61fa733aefd5f14c465cb1ac85a6a1bbc34fc2204876b76c631725690155eaa5d8f07648f22fe954b3b121c56046c24e99e3ab5b2bf10dbd85505d8f55a1cf985ecdf4a42b6d031ea322ac969f86acc6d3a8ba3f5361b6e05b86374bd43d707293c27993a5ac7595a0d5348332dc13c6b651b4a859702844cbded3c6bd35aa67c8fdfc4e913a8b8615ce28129aecf3217ecc4c2bfc48607b650c47bec3365e1af941b9046958b7c8b64bf45028760984336b6c27bc044a7ea69385805d089434190f0044d856ad2fbad4965846f59491e37f0256548d82145f571e18090b0fa91","salt":"d2deba0a43769862a0fbd80dd6fc867599706ca644920fe1bc05585f922b518e","nonce":"74e9fa0359646cdfbe86a7ad","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"358718727d4b43422a7719176c09b66f633e52a47ee3879d1e19b85cc362938d"}', + verificationProof: 'eip191v2:0xd7f0bc7c3960f84280c1433e27c0110dea4b4af1a8c10f7531b8194625cada9456cb67117154f20e97a3d8764b8e3e276d0e6da44f36c4a89a06da9a76d3821a1c', + msgSent: 1, + maxMsgPersisted: 1000, + profile: { + name: 'Bob The Builder', + desc: null, + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAnUlEQVR4AcXBQQ0CMBBE0c+kSXVUBWdMoGRl1AsSkLIWuO4Jrj2VNCTMe5fr9fFmI7L4xRydHWEmzIRZ49AcnZ3I4oQwE2bCrEUWJyKLE5HFjjATZsKszdFZRRarOTq/iCxWc3RWwkyYCbPGF5HFao7OTmRxQpgJM2HWIot/iixWwkyYCbM2R+fE/fVkZ44bJ4SZMBNmwkyYCTNh9gEzZiOL39d+3QAAAABJRU5ErkJggg==', + blockedUsersList: [], + verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk9vdaCZDzsIc63rzcLRYhBLvWJU1IWhvs+frC7POwhzre\n' + + 'vNwtAAB5dAf/cDGsyD3YabE6iTIhNPDn+hvbHuZUjpNPnnSb+mjrvD/XBNYV\n' + + 'ITTHhp3Xy4Kuk19BkgmPO3O5TZHVUXK7IwYJd7uutNJJyLEWZYI9ttfeJ9cY\n' + + 'HQM3GjApAHycDkBAn5ZRDtmruyWipeE1II3omDUgChQOnQFoK/jWohoIOUvO\n' + + 'zi+0V02z7uIGwgTjBLgOYehD8NloGxTjwaZHMqEN7xbr1mZqy82Aew1Bw+EY\n' + + '+JPMyiKTF6HXHYrJZL1yaNw/T7ukCI8ecGoql04xlOHU+SKUTz+8Kcg4tZQR\n' + + '0pp6Fz9Fy9ROUI8ieu5LytJwQq4c9VkH/SPUvkoODloXc0MbrY59tA==\n' + + '=A3pG\n' + + '-----END PGP SIGNATURE-----\n' + }, + origin: null, + name: 'Bob The Builder', + about: null, + profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAnUlEQVR4AcXBQQ0CMBBE0c+kSXVUBWdMoGRl1AsSkLIWuO4Jrj2VNCTMe5fr9fFmI7L4xRydHWEmzIRZ49AcnZ3I4oQwE2bCrEUWJyKLE5HFjjATZsKszdFZRRarOTq/iCxWc3RWwkyYCbPGF5HFao7OTmRxQpgJM2HWIot/iixWwkyYCbM2R+fE/fVkZ44bJ4SZMBNmwkyYCTNh9gEzZiOL39d+3QAAAABJRU5ErkJggg==', + numMsg: 1, + allowedNumMsg: 1000, + encryptionType: 'eip191-aes256-gcm-hkdf-sha256', + signature: '0xd7f0bc7c3960f84280c1433e27c0110dea4b4af1a8c10f7531b8194625cada9456cb67117154f20e97a3d8764b8e3e276d0e6da44f36c4a89a06da9a76d3821a1c', + sigType: 'eip191v2', + encryptedPassword: null, + nftOwner: null, + linkedListHash: null, + nfts: null +} +``` + +| Parameter | Type | Remarks | +| ------------------- | -------- | --------------------------------------------------------------- | +| did | `string` | user decentralized identity | +| wallets | `string` | all wallets associated to the did | +| publicKey | `string` | Public PGP key | +| encryptedPrivateKey | `string` | Encrypted PGP Private Key | +| verificationProof | `string` | Verification proof | +| msgSent | `number` | Number of messages sent | +| maxMsgPersisted | `number` | Maximum number of messages that can be persisted | +| profile | `object` | User profile information | +| origin | `string` | Origin information (source of the data) | +| name | `string` | Profile Name ( Deprecated ) | +| about | `string` | Profile Description ( Deprecated ) | +| profilePicture | `string` | Profile Picture ( Deprecated ) | +| numMsg | `number` | Number of messages sent ( Deprecated ) | +| allowedNumMsg | `number` | Maximum number of messages that can be persisted ( Deprecated ) | +| encryptionType | `string` | Type of encryption used | +| signature | `string` | Account signature ( Deprecated ) | +| sigType | `string` | Type of signature ( Dprecated ) | +| encryptedPassword | `null` | Encrypted user password ( Deprecated ) | +| nftOwner | `null` | Owner of NFT ( Deprecated ) | +| linkedListHash | `null` | Deprecated | +| nfts | `null` | Information about owned NFTs( Dprecated ) | -// need to decrypt the encryptedPvtKey to pass in the api using helper function -const pgpDecryptedPvtKey = await PushAPI.chat.decryptPGPKey(encryptedPGPPrivateKey: user.encryptedPrivateKey, signer: signer); +</details> -// actual api -const spaces = await PushAPI.space.requests({ - account: 'eip155:0xFe6C8E9e25f7bcF374412c5C81B2578aC473C0F7', - toDecrypt: true, - pgpPrivateKey: pgpDecryptedPvtKey, - env: ENV.STAGING, -}); -``` +--- -**Example NFT user:** +### **Create Group** ```typescript -// Fetch user -const user = await PushAPI.user.get({ - account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, - env: env as ENV, +// Create a Group +const createdGroup = await userAlice.chat.group.create(groupName, { + description: groupDescription, + image: groupImage, + members: [walletAddress1, walletAddress2, walletAddress3], + admins: [], + private: false, }); +``` -// Decrypt PGP Key -const pgpDecrpyptedPvtKey = await PushAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - signer: nftSigner, -}); +| Param | Type | Default | Remarks | +| ----------------------------------- | ---------- | ------- | ------------------------------------------ | +| `name` | `string` | - | The name of the group to be created. | +| `options` \* | `object` | - | Optional Configuration for creating group. | +| `options.description` \* | `string` | - | A description of the group. | +| `options.image` \* | `string` | - | Image for the group. | +| `options.members` \* | `string[]` | `[]` | An array of member DID. | +| `options.admins` \* | `string[]` | - | An array of admin DID. | +| `options.private` \* | `boolean` | `false` | Indicates if the group is private. | +| `options.rules.entry.conditions` \* | `any[]` | - | Conditions for entry to the group. | +| `options.rules.chat.conditions` \* | `any[]` | - | Conditions for chat within the group. | -// Actual api -const spaces = await PushAPI.space.requests({ - account: `nft:eip155:${nftChainId}:${nftContractAddress}:${nftTokenId}`, - toDecrypt: true, - pgpPrivateKey: pgpDecrpyptedPvtKey, - env: env as ENV, -}); -``` +\* - Optional <details> - <summary><b>Expected response (Get spaces requests of a specific user)</b></summary> + + <summary><b>Expected response</b></summary> ```typescript -// PushAPI_space_requests | Response - 200 OK -// Array of spaces -[ - { - spaceId: - 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', - about: null, - did: null, - intent: - 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A+eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868', - intentSentBy: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - intentTimestamp: '2023-07-12T01:11:32.000Z', - publicKey: null, - profilePicture: null, - threadhash: null, - wallets: null, - combinedDID: - 'eip155:0x12E429E3672a02E385F9f5F75E932cC1D566EEea_eip155:0x49D407CC9D0e966CD9B22BA40685083B49bd2315_eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868_eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - name: null, - spaceInformation: { - members: [Array], - pendingMembers: [Array], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: - 'pgp:-----BEGIN PGP SIGNATURE-----\n' + +{ + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + '\n' + - 'wsBzBAEBCAAnBYJkrksbCZA3GHnYNke0AhYhBNp+D95LDfs4yU03LzcYedg2\n' + - 'R7QCAACRdAf9ELAnCLXfBiAVdbgwj81xr+w9Yzw2wXLLrPLfYY7EXfyChLzQ\n' + - 'rr9XBDdWMgtzEU1diSPMbLDh1METR7n71EjG0AoeX5A2pkHI7R1vIxXUJR3G\n' + - 'fzHENsfGaKLnhrL1wLjBQACzEsIqPrHl9RItdtKEs9izLmc+wV0GFJ5OjbAs\n' + - 'ty/1Q36nnMB7sQ7Ytb9Op+q0TtZPZ7jF9CjX8KGav3P1xDQex9nfsXiDHlLK\n' + - 'MqDePaaMO6RJUWAP2xTo2k1DDJQ2dpUhs9XyjMlvFhVbIcT1/lVRCPC8V3C8\n' + - 'fUKhUejvOjNFxf0QuR+E4xs+Q3zvR1+fXdJBxbH2Fp3kOTN1N9/LEw==\n' + - '=sLLC\n' + - '-----END PGP SIGNATURE-----\n', - spaceImage: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'statutory_amber_roadrunner', - isPublic: true, - spaceDescription: 'continued_bronze_pigeon', - spaceCreator: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - spaceId: - 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', - scheduleAt: '2023-07-12T06:51:32.000Z', - scheduleEnd: '2023-07-12T07:41:32.000Z', - status: 'PENDING', + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null }, - msg: { - fromCAIP10: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', - toCAIP10: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', - fromDID: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', - toDID: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', - messageContent: "Gm gm! It's me... Mario", - messageType: 'Text', - signature: - '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkWKQWCZB7dzg7q3axjBYhBJFuYslzDGbuE+3FMnt3ODur\n' + - 'drGMAAAjtAf/TXjtm2qb6aSikFPKYXm0Ekws+65fisJGf7T48MYkkfcD4t2e\n' + - 'HXd9LtohzGhcztbOQfAND3yME1GWuMBIksq9rlyEA0ezwsGzCJVhBnkAHBe3\n' + - '+1v4/mNSMmInU8y6sOiLiOcW7ameJvZvDdPDJ0YHhc9dKDCIh1UAZEPAgx+z\n' + - 'Wc0DM6pW8bT70dfgnuW2LlLGF5Z23Z1vbHmeszt78+xYY3ez/hoMHXUIE25z\n' + - 'Wrnt75nasBBahtJ0mwH10ATnsQNE9hTi6XPGYxRSNDM9nyRxTQUpjhNmGS/+\n' + - '7oFyq8xTcRSaL7d3h8URp9hgFWher5ZZDyMV0jvk+HPguUX54g6Kgw==\n' + - '=dcRD\n' + - '-----END PGP SIGNATURE-----\n', - timestamp: 1683530775648, - sigType: 'pgp', - encType: 'pgp', - encryptedSecret: - '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMA9aU+JGZVRn/AQgA1pIJHyeJinU21r6At5S5ZaWeN0OEKVB2TjpqZ0IW\n' + - 'lHLKQrQ8k3M16bN+Vf0P+DzDVOL84QRkBD56qSNVHOOCox5wcQeR01CczenV\n' + - 'LUVvVjBzR2hj7Sdw+Q+M//rgeZPPUDbNyiVmGijelhwDqWd7IOoZY26AGXlm\n' + - '7YQiElvHN2HcYXaTlLAOy36BcccwHu3Tn06F77ZXaf8FnGMWOUy7wh1/jugg\n' + - 'D17jUZGLYbmw+u5l9BOfljbw2pb4vtjWht0I1b4GYlKb+bYg/NY0UNsq7mSh\n' + - 'dGAmOhy5tC2NMjLRRLfD2qasxHoHN50onlB6HcYLl0RCf31ebOgO6rMhUnxt\n' + - '9cHATAMLWLG2xubrYAEH/2tVeq2j7nJALGSFxjJPboOY57aiFrhXNQ/e/oXH\n' + - '//TNJgGWx4Ta++OuF2Oexbh9DIZhl6DWld9adXDDtBS/fEyjNsYqwoYlNEJN\n' + - 'kLvSmokNNrE4MKC1A0GkhSh2MGQDNk42GSgz1tep8XSVc98MHqfNXCHVb5Oa\n' + - 'OBeWKLFyElT3+KuZxSkCsnoO5YjuCGbXPyG06tXMHXMTncpj1ri+vpjUSnhD\n' + - 'wn3o0zpNWu0GaWXIgTqj2ZouVwV2S1+wAJQjE8uI1JvBiMhA+X63/GCcApBu\n' + - 'C7rN0Cs5NGXCn9VWp8i1SCp2NuZ38POABwsXUUkjpF24txyUDX8dbXlkzpao\n' + - 'g93SQAElYYmyKbGp1TKhAZl2u40mgf2yCYDv2DLRfAKMJDLvmjXoUGEg2UYO\n' + - '11w6LD0pIykdKJmFtRls/uMnlcoBgDA=\n' + - '=kzUH\n' + - '-----END PGP MESSAGE-----\n', - link: 'bafyreib34jgnpp573rwquejcq5avxvydis7fbykat6dd5z7uazobucoumm', + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null }, - }, -]; + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'create' +} ``` -| Parameter | Type | Description | -| ---------------- | -------------- | ------------------------------------------------------------------ | -| msg | `IMessageIPFS` | message object | -| did | `string` | user DID | -| wallets | `string` | user wallets | -| profilePicture | `string` | user profile picture | -| publicKey | `string` | user public key | -| about | `string` | user description | -| threadhash | `string` | cid from the latest message sent on this conversation | -| intent | `string` | addresses concatenated from the users who have approved the intent | -| intentSentBy | `string` | address of the user who sent the intent | -| intentTimestamp | `number` | timestamp of the intent | -| combinedDID | `string` | concatenated addresses of the members of this space | -| cid | `string` | content identifier on IPFS | -| spaceId | `string` | space identifier | -| spaceInformation | `SpaceDTO` | all space information | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | </details> --- -### **Fetching list of trending spaces** +### **Fetch Group Info** ```typescript -const spaces = await PushAPI.space.trending({ - env?: ENV; -}); +// Fetch Group Info +const fetchGroupInfo = await userAlice.chat.group.info(groupChatId); ``` -| Param | Type | Default | Remarks | -| ----- | ------ | ------- | ---------------------------------- | -| env | string | 'prod' | API env - 'prod', 'staging', 'dev' | -| page | number | 1 | page index of the results | -| limit | number | 10 | number of items in 1 page | +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ------------ | +| `chatId` | `string` | - | Group ChatId | <details> - <summary><b>Expected response (Get trending spaces)</b></summary> + <summary><b>Expected response</b></summary> ```typescript -// PushAPI_space_trending | Response - 200 OK -// Array of spaces -[ - { - spaceId: - 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', - about: null, - did: null, - intent: - 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A+eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868', - intentSentBy: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - intentTimestamp: '2023-07-12T01:11:32.000Z', - publicKey: null, - profilePicture: null, - threadhash: null, - wallets: null, - combinedDID: - 'eip155:0x12E429E3672a02E385F9f5F75E932cC1D566EEea_eip155:0x49D407CC9D0e966CD9B22BA40685083B49bd2315_eip155:0xF8aBe92d1d0706bF60509F8E9A64Ed6b8520E868_eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - name: null, - spaceInformation: { - members: [Array], - pendingMembers: [Array], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: - 'pgp:-----BEGIN PGP SIGNATURE-----\n' + +{ + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + '\n' + - 'wsBzBAEBCAAnBYJkrksbCZA3GHnYNke0AhYhBNp+D95LDfs4yU03LzcYedg2\n' + - 'R7QCAACRdAf9ELAnCLXfBiAVdbgwj81xr+w9Yzw2wXLLrPLfYY7EXfyChLzQ\n' + - 'rr9XBDdWMgtzEU1diSPMbLDh1METR7n71EjG0AoeX5A2pkHI7R1vIxXUJR3G\n' + - 'fzHENsfGaKLnhrL1wLjBQACzEsIqPrHl9RItdtKEs9izLmc+wV0GFJ5OjbAs\n' + - 'ty/1Q36nnMB7sQ7Ytb9Op+q0TtZPZ7jF9CjX8KGav3P1xDQex9nfsXiDHlLK\n' + - 'MqDePaaMO6RJUWAP2xTo2k1DDJQ2dpUhs9XyjMlvFhVbIcT1/lVRCPC8V3C8\n' + - 'fUKhUejvOjNFxf0QuR+E4xs+Q3zvR1+fXdJBxbH2Fp3kOTN1N9/LEw==\n' + - '=sLLC\n' + - '-----END PGP SIGNATURE-----\n', - spaceImage: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - spaceName: 'statutory_amber_roadrunner', - isPublic: true, - spaceDescription: 'continued_bronze_pigeon', - spaceCreator: 'eip155:0xf4c946D6bd5cF09713D27364bbEd42712Bdffa8A', - spaceId: - 'spaces:3aa43087b8c55ed9c534dd1d0a086a3340b0d829cda0a13592651cb59f284838', - scheduleAt: '2023-07-12T06:51:32.000Z', - scheduleEnd: '2023-07-12T07:41:32.000Z', - status: 'PENDING', + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null }, - msg: { - fromCAIP10: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', - toCAIP10: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', - fromDID: 'eip155:0x1615d2D9ae82D5F0eE79298899962b237386feB7', - toDID: 'eip155:0x1C48fE875590f8e366447758b13982a3Ca7d9dBE', - messageContent: "Gm gm! It's me... Mario", - messageType: 'Text', - signature: - '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJkWKQWCZB7dzg7q3axjBYhBJFuYslzDGbuE+3FMnt3ODur\n' + - 'drGMAAAjtAf/TXjtm2qb6aSikFPKYXm0Ekws+65fisJGf7T48MYkkfcD4t2e\n' + - 'HXd9LtohzGhcztbOQfAND3yME1GWuMBIksq9rlyEA0ezwsGzCJVhBnkAHBe3\n' + - '+1v4/mNSMmInU8y6sOiLiOcW7ameJvZvDdPDJ0YHhc9dKDCIh1UAZEPAgx+z\n' + - 'Wc0DM6pW8bT70dfgnuW2LlLGF5Z23Z1vbHmeszt78+xYY3ez/hoMHXUIE25z\n' + - 'Wrnt75nasBBahtJ0mwH10ATnsQNE9hTi6XPGYxRSNDM9nyRxTQUpjhNmGS/+\n' + - '7oFyq8xTcRSaL7d3h8URp9hgFWher5ZZDyMV0jvk+HPguUX54g6Kgw==\n' + - '=dcRD\n' + - '-----END PGP SIGNATURE-----\n', - timestamp: 1683530775648, - sigType: 'pgp', - encType: 'pgp', - encryptedSecret: - '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMA9aU+JGZVRn/AQgA1pIJHyeJinU21r6At5S5ZaWeN0OEKVB2TjpqZ0IW\n' + - 'lHLKQrQ8k3M16bN+Vf0P+DzDVOL84QRkBD56qSNVHOOCox5wcQeR01CczenV\n' + - 'LUVvVjBzR2hj7Sdw+Q+M//rgeZPPUDbNyiVmGijelhwDqWd7IOoZY26AGXlm\n' + - '7YQiElvHN2HcYXaTlLAOy36BcccwHu3Tn06F77ZXaf8FnGMWOUy7wh1/jugg\n' + - 'D17jUZGLYbmw+u5l9BOfljbw2pb4vtjWht0I1b4GYlKb+bYg/NY0UNsq7mSh\n' + - 'dGAmOhy5tC2NMjLRRLfD2qasxHoHN50onlB6HcYLl0RCf31ebOgO6rMhUnxt\n' + - '9cHATAMLWLG2xubrYAEH/2tVeq2j7nJALGSFxjJPboOY57aiFrhXNQ/e/oXH\n' + - '//TNJgGWx4Ta++OuF2Oexbh9DIZhl6DWld9adXDDtBS/fEyjNsYqwoYlNEJN\n' + - 'kLvSmokNNrE4MKC1A0GkhSh2MGQDNk42GSgz1tep8XSVc98MHqfNXCHVb5Oa\n' + - 'OBeWKLFyElT3+KuZxSkCsnoO5YjuCGbXPyG06tXMHXMTncpj1ri+vpjUSnhD\n' + - 'wn3o0zpNWu0GaWXIgTqj2ZouVwV2S1+wAJQjE8uI1JvBiMhA+X63/GCcApBu\n' + - 'C7rN0Cs5NGXCn9VWp8i1SCp2NuZ38POABwsXUUkjpF24txyUDX8dbXlkzpao\n' + - 'g93SQAElYYmyKbGp1TKhAZl2u40mgf2yCYDv2DLRfAKMJDLvmjXoUGEg2UYO\n' + - '11w6LD0pIykdKJmFtRls/uMnlcoBgDA=\n' + - '=kzUH\n' + - '-----END PGP MESSAGE-----\n', - link: 'bafyreib34jgnpp573rwquejcq5avxvydis7fbykat6dd5z7uazobucoumm', + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null }, - }, -]; + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'create' +} ``` -| Parameter | Type | Description | -| ---------------- | -------------- | ------------------------------------------------------------------ | -| msg | `IMessageIPFS` | message object | -| did | `string` | user DID | -| wallets | `string` | user wallets | -| profilePicture | `string` | user profile picture | -| publicKey | `string` | user public key | -| about | `string` | user description | -| threadhash | `string` | cid from the latest message sent on this conversation | -| intent | `string` | addresses concatenated from the users who have approved the intent | -| intentSentBy | `string` | address of the user who sent the intent | -| intentTimestamp | `number` | timestamp of the intent | -| combinedDID | `string` | concatenated addresses of the members of this space | -| cid | `string` | content identifier on IPFS | -| spaceId | `string` | space identifier | -| spaceInformation | `SpaceDTO` | all space information | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | </details> --- -## PushAPI Class +### **Fetch Group Permissions** + +```typescript +// Fetch Group Permissions +const fetchGroupPermissions = await userAlice.chat.group.permissions( + groupChatId +); +``` -### **Initialize** +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ------------ | +| `chatId` | `string` | - | Group ChatId | + +<details> + + <summary><b>Expected response</b></summary> ```typescript -// Initialize PushAPI class instance -const userAlice = await PushAPI.initialize(signer); +{ + entry: true, + chat: true, + rules: { entry: { conditions: [] }, chat: { conditions: [] } } +} ``` -| Param | Type | Default | Remarks | -| ------------------------ | -------------------------------------- | ------------- | -------------------------------------------------------------------------------------- | -| `signer` | `SignerType` | - | EthersV5 or Viem Signer | -| `options` \* | `PushAPIInitializeProps` | - | Optional configuration properties for initializing the PushAPI. | -| `options.env` \* | `ENV` | `staging` | API env - 'prod', 'staging', 'dev' | -| `options.progressHook`\* | `(progress: ProgressHookType) => void` | - | A callback function to receive progress updates during initialization. | -| `options.account` \* | `string` | - | The account to associate with the PushAPI. If not provided, it is derived from signer. | -| `options.version` \* | `string` | `ENC_TYPE_V3` | The encryption version to use for the PushAPI | -| `options.versionMeta` \* | `{ NFTPGP_V1 ?: password: string }` | - | Metadata related to the encryption version, including a password if needed. | -| `options.autoUpgrade` \* | `boolean` | `true` | If `true`, upgrades encryption keys to latest encryption version | -| `options.origin` \* | `string` | - | Specify origin or source while creating a Push Profile | +| Param | Type | Remarks | +| ------- | --------- | ----------------------------------------------------- | +| `entry` | `boolean` | Refers if the Profile has access to enter the group | +| `chat` | `boolean` | Refers if the Profile has access to chat in the group | +| `rules` | `object` | Moderation rules of the group | -\* - Optional +</details> --- -### **Fetch Info** +### **Update Group** ```typescript -// Fetch Info -const aliceInfo = await userAlice.info(); +// Update Group Info +const createdGroup = await userAlice.chat.group.create(groupChatId, { + description: newGroupDescription, + image: newGroupImage, +}); ``` +| Param | Type | Default | Remarks | +| ------------------------ | ------------------ | ------- | ------------------------------------------ | +| `chatId` | `string` | - | Unique identifier of the group. | +| `options` \* | `object` | - | Optional Configuration for updating group. | +| `options.name` \* | `string` | - | Updated Group Name | +| `options.description` \* | `string` | - | Updated Description | +| `options.image` \* | `string` | - | Updated Image | +| `options.scheduleAt` \* | `date` or `null` | - | Updated Start Schedule | +| `options.scheduleEnd` \* | `date` or `null` | - | Updated End Schedule | +| `options.status` \* | `string` or `null` | - | Updated group Status | +| `options.meta` \* | `object` or `null` | - | Updated Group Meta | +| `options.rules` \* | `object` | - | Updated Group Moderation Rules | + +\* - Optional + <details> <summary><b>Expected response</b></summary> ```typescript { - did: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', - wallets: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTu6YUBCACa7JaMqfhAnD/9ynE5Rhi8KNQ1tfdQe0ay/9jXX2naZIA+\n' + - '6WCi1uNcB2TTLfMuzsEl4u/26LTgtkr51snRt2QKgEqi5dXqbRD76wiRLd4h\n' + - 'ktBb4WB28o+BWOHYYJQq8he+zu3mQWjKLb1e9DyS0cTzwPwWVKce9IsG3NOi\n' + - 'eM7O5Kg5cU3qHXR+frF25peCBrzNXH+xuuTJPsX85h9dSz/u6dWXhk2LsX3s\n' + - 'cmX5mFcFErnGvUBddDGZc11q+WzZAtENPCxQrNjpkMtzCj9UMwgsJdzBghZZ\n' + - 'ZouGTG2uhfmIj3/KHOdwx/KGpTgC1iMVOb78kw9LmaxL6fGy4x9uvvI3ABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO7phQQLCQcICZABDloJB8hpcgMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBMga3B8GDU79nd/0mAEOWgkHyGlyAAAbHAf/bJMPIyvNZNjO\n' + - 'JK2xA1hYpzIGdbi3jMego6GXrmet3qY50zMKDccB2Ot399y/nmWMVEyfKYaP\n' + - '7N+mJbeAqIZ8TAHtpw++k/h8/hXoxb9iPsQyWYossuG499XyHnk+KEd4g0Wf\n' + - 'mqPk/XJB3xLLgW820jOsRRbWLyYKJEdh1Q+GIM+D6oIJ9ZmyRPv25u6yCF2P\n' + - '2IQZErWeYD/LxqMDw+uHdRZJRiyFy/Y7A43clejN+p3my8oktXh2N4+tEl7i\n' + - 'Hwxc5z9AOffuEyUerm0Rjwdn8rG8po7AfuXwmTiW1Sdc9TdJtAK/n6e9EFHV\n' + - 'gHzArwyaydHHy80Wqa+UF591NkPi387ATQRk7umFAQgAs0ao+EFoKJirGHfI\n' + - '69vZg+eAAUUKG657BzNzTAF2r5Y+a61jdcCAL+DXBcfks+H0dqG36zjOZTCJ\n' + - 'NirABp5RRPFty2VvUtOyezuKX/MBVg3st3t/yE3SncVaWMblAv3iegviNNpH\n' + - 'cFKqpHoVBWDNdhFHNsKTjpJcq3BVohy2Dxh8Di8N/1+gEPxADvIuH9MQ8MJk\n' + - '6lB9XYXBmmqtlQ3sB916mvusUIl8Zxw1C76yY0PAXz055zJMiL1vwo5gKDiV\n' + - 'iKyzry3wq7upPGJyeTKu7uUMifTPhJtyYvon2TIik5DIgHpqKziirCrolA+s\n' + - '7LhnFbawqDKleEdyCcL5mFCzXQARAQABwsB2BBgBCAAqBYJk7umFCZABDloJ\n' + - 'B8hpcgKbDBYhBMga3B8GDU79nd/0mAEOWgkHyGlyAABIqQgAmK9ijEEvtWTm\n' + - '7/mhkuDEtfPfcMexfkaCcGL4SdZqVz/h+eIL8+4EbI9uq+YTzcjtX8FAEQta\n' + - 'KWFACNEOPmSy6Sb9bDoNZUVpDaZzNNtqIK9Brt4zjJLEsDfmkuW3S/SgIYBQ\n' + - 'yTkuNmmAf8dr7L4fG0JlxPyGaL1/w9UDAr7xdU7WcHuyPc0edDGeE7NwaGWp\n' + - 'uBipXFw8AkikV3fCTDuOi3uhkIzZ5zlGCshD7m0aDSABwr4hbFzLFBDSrsiW\n' + - 'GKhWGYgf5Vx8qzlwXYYnoW/rn3UXWpeTXjq46ZNaxjHJ4VxGMyn/tHZOEjDE\n' + - 'vHapLIAgGyw2b+s+zZSqsXaMkH8WOw==\n' + - '=gPzx\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - encryptedPrivateKey: '{"ciphertext":"4f1243e1ffa76180f46ade2eb093867750c6bf72e8d6c71c7c0edca176c2f9fb32c603bb5e52d933730e0350292431b6e5287b8201f60ce9151b6a141bde98cdc3d9e5df8f84e00e5e4173bdf28b66e9590db10195fbd41ed241a65ab84fb5da251f613376bf78efe1af64613dd54fb05dced7cf8de0907d61489712ad42f06b5c775d97d15dee09b1c58cd79f596674e403353bc7e03297aa0d3fdaecac573c962409622ff8b1335b6fbb661bd2d5f5a076d9079f857849ba917662b40151041eca71385844160fc603c4d1beefbf71b26ac8968de52d6bb534ef6d6e2ea987170059d7d881dc684d28b5b2817804fba3b659e3ec0e802583e581b9f75d2f7e69e428cba91e62719e9ca6697588389db89b982370d23952120c0f972ab4b3a0da888d52b5055c60785d276152e43929df532bc7d5d68c6bc3cfdd1ca780df346113999a19d8e4a96c02f149d1ee4cde802277081ef339153872c00c9e9ddfe3ba8da8c68c0565752fea32258087e66aab37397a27b0228b5ed1aeb09a93b80778fd7f949409106c4cd82ff550aafb9d7bdce8727a76882f59ef2c54a137e51f04b6c27a0b1b92cd781dafb489a5e8203232669f5416454cc9cfe8c5b0fd8abc19d9ef16285a8da0aca2ed747adef7b49b8215790266d9c4791c250b0580e89c6429d10a1bcd45cf016a7ae30e1db948147d992722a7191e31852e6fd3c3679d868f34ebbe65f255be4b90dd64ceb52eaeee7d3356683b7fd511729493c887289ddb0f00c65ca2a95114f0e37d3b73d06333e2787c5fa6dd6f6c9e8334ff153dd63e30c81247efd497cf2c038843d8653edf23822eae07dd19d0be26a921673185bcf016533fdb59150ff46096419e6a6aeb1bd4293fc8146848d715d43afd04aa40f2b5ae9d058671677aad2413952a20b5214e18bbf3b4b033d936d673a0302967de3f74b05b74bc6c89f30ddeaab1bf6c567fcee355797b6cba17c3fcc8955bdf096e2dda2577b3374089d8c9d287552e5658c91e812bd0b8b63482c8de98fde216dd557eb34bafca2f8e73dc4582fa36332e8869f2717519921605915d8e1c75a37295e198ec0af75926d89a6832456304474a10c567334998226d9b6f709ebc216fb067d958e78a622040c91f46af202273d0b40307fb34cba5a6a57fbb196ac6e88c16d527b9bdb04b12fa7ed0bc771692712ccd146c41890b5caddbbb13b8ba77e632b2d7597256fb576ce87d2aff35a0e953b8227a5dcbf30f7d189ca7f77f6f8b2c4eb2752199a7a485ab52a6b65b6edd6cf65caaeb6f65544cc74c2fb3431fa484fb69adbda08d2402da953f20425832b6a2d712d56a5cc34095f25fb9524a478a71d387b7dea45b4bd41e79c61dceca332898dfeecf83999ed4fad892e2ede714b93f3969ad140f38bfa95d321ae5ef089cf0ce435d59f8b6611c0fd014c67ed38646f0771f1a74c1f950ee0900d883aca3ec4efbb2f7737e717007ae757d874573d4d70c9d7e38f8ff30a29b983036e684c4eaf35a7c03ed32a8e3fc62f0863c56830127a5f3c0e905a93e7466a4f43f0793cb6752b9be8d03d7be26170f694ecbb200f611bbf1dac4b6ec085deb8c3d8ee188d8c9c8c17ca720c0f0dee4d00e5866b5443b6af6e69ca64b8eb5a8f5fa1e1d27bfacbf1b0ae11241215358f5045b0d1a73d1b15dbd904709340c1e2b42a4ef78f76b8f901d6337849cff1052f06a8919255b596fb36d2fdf789fdf611813d20729c26d517dde6f11a3f6045ec5158652e128cf7c483a0fb8ab772cb5cdb56e42e6bf8c863f173307c3e053168e54e9e65bcacbb144413ff76d08a94929e6cdde2c5944246a4b344f3ca0ada3b403429750bdce76f04668b05ed79e9119f00901e7f7b4f1eea8a1b5b0186e3ed41277040a257601b0f3917db595f3f1808d92071a4e9521a251e9c5a66f2c8a57511f61b9fd88df77330aeb4bc15c043814b33610d60f6d0a13fd7977efaa1843913f6d3a79bc88020406c9979163684efe7b7ade9613221d06b52cd96abd31b77a707748d52e6e16c8c90821f29359b35307c10dafce5f35c0ff9802c23aef19f0a95b49a317cd6207002a5a9b822b4c056c4cbf9b27045dda8325d93060f358bb837f00954a6e281d1bdd1817a7cce8ed4a801f9164d32c52739c1ac650109868664be1fabab47c675222dc9ff9d75f9fb49531c832264aa5b55998675975f59e34829ce90b00092bd77e46328a6459d5c967d905b8e976611b839925ad742500231fa86cb5f7e6f39cb1e2e36b81c55269ea0f5fdcba5c8c0e38a899540d52be49c83efae5243998b926f029dc2980d4fdb1c125db409d015e0b36bc02272da1c688ee1f61d23cbde585064ab1e2164d0ca529774ec7797407ba5d988c58853e74a124a64dc24d0289b6a599354faf64790177c3032f5d660d7b76dfbf1c03388a7c75b2309c509c6a92144e124c8bd188274bc844e8f0aa7b5a06e79ad5776b5a62003b89aef194dcc03cd3c1b1f3ea541805cfc4e18aa159f9b5395185b573538c9bab16876dff91f365d16dcc56b339b01b86882ef8e52c51edd9c5b2f8a35713ed6eb43036e09f64f6e59ab417958faff974b6705400b341439fef4cba371c601927da7e0a8f23e1c6d3e070a19c2216da85f159d60303ab1321e479f4c371372845cef03daa7d2776c18face6cfa2ff9eed26f9f0a353a0f1c9a99b2556dccc1212fcb5c2078a3b0e58a7f3f7b3f346d624435ef94c95d40dc726d2e7400ae405e89473a934e7646124e34473dfe17f7f9cf481aa059ef422508ffe67f9b9276084973db0683269a046c1a0aafa7ab075b28008cbfb862b7e30c8b2afa1c2923d914b3d2469266e8e0182274a3d8d89642723820e61aa2d97a9370789ec4e89ebee05b6c0bef10778caf2a34c2d7622dde5fa64b012bea6205127c3c845229ef553f013b73823dc6631078fc628532e3e518bdc790ab8460078dedf0c5cb00492136813e2b91679bba82f3cf95169751933bee4358f84154014dbcc1de1a30613218039ebb2444429380fd283d3b60bd5d5b470e861f6ecc751c22aa467168512a0ef45755e6b59a7be591bd3b08fde874b166ccfbbedba10a0956d2d18cbda515341c2112d6094a746e9f562db6543e5bde2c4d4f7c06b7550400d66f7242a14f34cd8a7374372f0eea49a49b72909fc11ff81ea54a1e2c07225cdee856383a657b0f13c14b00ae3b7b2a32a22beaab8cfd18641dbfa82619fdcdddd3339e9423e71c487305e8aa932b694e94c37c7e418e4014c8bb264f47e8283e216eeeabf0fbdd2f5eb8d0ea979738d4f18b7bf72d7711f5d22653f217c7305314ec2c47a0ecbf1dc8f9bc1379ae38e2a04e736a1171b947609bb66f8d352ce57230d709f196953471c5504c7f9f40ed2f64bf3bd04bd57521a364ea03b5f0603cceec7851738d97c3fd73c16547d4d143b009a79832a1ed244937dce09edf2d5e32ae52ab0331c449325dce9e5e8ed1563c967a5f92031f4275e3179274ef3e0752ac01caf8a20aabb23d584d4d6607833f95cfc92832d936c37bb8b37222aa842f48944d06b37434c8dce5f19b450a7d1bd568672ef2c8eaa2afb7cff404b33377a61061f56b01849feb918521a7d63cfbe12466aedc7159c577f213f2c157586b8719164cd7108edfa9211287b43aadbad997bc62f8169eec4a6e02aeb535f670878e6af538b5281da04470d318f893102613977390a434e0557302a68ce42e532d350446d4d813b84c07b42bf22fbe4889096ec6303574c95040d8dcfed1b9bd26782c5033d7d1a491fece156cbc19a705204ed38a547e00a09b73bc7a702ef9c2e659171d1daab63958268148aba59766bc7a4ffb68c1ae047d1f0c5fb45fbacd07079f72af301c6aa00eebc0662c6792fc707d388b339d4f45afbf576bacf8730ec3e0f1e9dc0f9a6d58fd146b2293aed8d110da24336f9a4c01ae12c03ce214c6502f5fbc5224dd8b8b2e4edf2af16b811e5c8595fa76cafe34ba66199caaed48b5dfd5ae74a3e6b6d51a09c70afc30ebc0f40d51a15f1a8c2c41ec482eddf14bed3fd11a9e2aa4446268af25b49e429e2528d5df57797f6f3cd431eb5ded8f830c85cecde8012c31500ce9363903739a6759704fa87bfef984ed0285c8c0a5bf2f0985b1b511eb4145e4b27e2df6aa7b5c7a913b76b1ca869151b75c0717389b3d186f4e4637a5ceba3cef64809c3a06551a6a46be31af61c0ef78afb057f6cc625647dc04dcd74eb97f7aee0f5640e24b7662c799013efb83c80ec2851acda7c6328de789ae99ce296494225bd169e49c9a12dc7e281778f7fe275e72571cd5a3608733998d2f6b96c1d26c25223153fc5afc2f6e3d72f57fbcb2d087d718d3b6703b286f1e340c23cd3bc715797edf3ce6d5169bcf783ac9686233cc0358725143008b25bfbd329e1c30654e4b4c9461239d41ae77f706e64e5e60ce6de83becfd056f2678f17474ab9f4976b2d7d5d014d78f716d7d4edbf6ce4ed44ed677274d6b9b6e4bf4946dfd1ed8b821c81957b4bf5cd534ed6ca84dadd9d6380513dc6406b32dcd5c1bfa468a79e88a56656e71aed0c6675540e1617a31e1c122295427590e83b63e8da58a6c5c21a15703994bdc2b90d399b62679a4269224257f3ead5a2dd0980e6f5a45c5a9392929cc4743e106c7335136c9f8a3a29190462eef908eab02cda97dbcb71dff26b0ef4dae51de293b4cff0ebf37fce1391247c5ccf77dfb64974c4a1e6beeaf82041bb0d653e2e9b612f3442bba8480b86fd7b35514fc056d7429d5fb36199d4a6f632ea615d9acc961082d9d91aca416b57582bcd2f182f5f5be02b3f597c680b2e6b37ee4d133e51d077491cb536d6261808c42684d0912fd7bcc97dacdf32394e7b","salt":"da23dc7dbf23136dabc337a0caa170c0db7e4efec5f5c8a648dff9b7cd7df49f","nonce":"fe0e4ec3d40fb7de21a354bf","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"b43efae4c92a35d9c0b5f6178cb8b8a6642c77d0a9281f61beb9f6e8f7b006a5"}', - verificationProof: 'eip191v2:0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', - msgSent: 0, - maxMsgPersisted: 1000, - profile: { - name: null, - desc: null, - picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', - profileVerificationProof: null - }, - origin: null, - name: null, - about: null, - profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', - numMsg: 0, - allowedNumMsg: 1000, - encryptionType: 'eip191-aes256-gcm-hkdf-sha256', - signature: '0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', - sigType: 'eip191v2', - encryptedPassword: null, - nftOwner: null, - linkedListHash: null, - nfts: null + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'update' } ``` -| Parameter | Type | Remarks | -| ------------------- | -------- | --------------------------------------------------------------- | -| did | `string` | user decentralized identity | -| wallets | `string` | all wallets associated to the did | -| publicKey | `string` | Public PGP key | -| encryptedPrivateKey | `string` | Encrypted PGP Private Key | -| verificationProof | `string` | Verification proof | -| msgSent | `number` | Number of messages sent | -| maxMsgPersisted | `number` | Maximum number of messages that can be persisted | -| profile | `object` | User profile information | -| origin | `string` | Origin information (source of the data) | -| name | `string` | Profile Name ( Deprecated ) | -| about | `string` | Profile Description ( Deprecated ) | -| profilePicture | `string` | Profile Picture ( Deprecated ) | -| numMsg | `number` | Number of messages sent ( Deprecated ) | -| allowedNumMsg | `number` | Maximum number of messages that can be persisted ( Deprecated ) | -| encryptionType | `string` | Type of encryption used | -| signature | `string` | Account signature ( Deprecated ) | -| sigType | `string` | Type of signature ( Dprecated ) | -| encryptedPassword | `null` | Encrypted user password ( Deprecated ) | -| nftOwner | `null` | Owner of NFT ( Deprecated ) | -| linkedListHash | `null` | Deprecated | -| nfts | `null` | Information about owned NFTs( Dprecated ) | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | </details> --- -### **Fetch Profile Info** - -```typescript -// Fetch Push Profile -const aliceProfileInfo = await userAlice.profile.info(); -``` - -<details> - - <summary><b>Expected response</b></summary> +### **Add To Group** ```typescript -{ - name: null, - desc: null, - picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', - profileVerificationProof: null -} -``` - -| Param | Type | Remarks | -| ------------------------ | ------------------ | ------------------------- | -| name | `string` or `null` | Profile Name | -| desc | `string` or `null` | Profile Description | -| picture | `string` or `null` | Profile Picture | -| profileVerificationProof | `string` or `null` | Profile VerificationProof | - -</details> - ---- - -### **Update Profile Info** +// Add Member To Group +const addMemberToGroup = await userAlice.chat.group.add(groupChatId, { + role : 'MEMBER' + accounts: [account1, account2] +}); -```typescript -// Update Push Profile -const updatedProfile = await userAlice.profile.update({ name: updatedName }); +// Add Admin To Group +const addAdminToGroup = await userAlice.chat.group.add(groupChatId, { + role : 'ADMIN' + accounts: [account1, account2] +}); ``` -| Param | Type | Default | Remarks | -| -------------------- | -------- | ------- | ------------------------------------------ | -| `options` | `object` | - | Configuration options for updating profile | -| `options.name` \* | `string` | - | Profile Name | -| `options.desc` \* | `string` | - | Profile Description | -| `options.picture` \* | `string` | - | Profile Picture | - -\* - Optional +| Param | Type | Default | Remarks | +| ------------------ | ------------------- | ------- | ----------------------------------------------- | +| `chatId` | `string` | - | Unique identifier of the group. | +| `options` | `object` | - | Configuration for adding participants to group. | +| `options.role` | `ADMIN` or `MEMBER` | - | Role of added participant | +| `options.accounts` | `string[]` | - | Added participant addresses | <details> @@ -4223,500 +4118,830 @@ const updatedProfile = await userAlice.profile.update({ name: updatedName }); ```typescript { - name: 'Bob The Builder', - desc: null, - picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA0klEQVR4AcXBsW0EIRRF0esv0k2mGhogp4FJ3AC1UMM2QE66AQ24DZIpwE75E2CtbOmd8/H1+vxmcZ2ZVao4vbCVKk4vOI9nY2WIGWKGWOAmVbZS5S2p4gw8Q8wQM8QCv+gFJ1W2esFJlS1DzBAzxEKcmVUv/KtecGLNrAwxQ8wQC+NoOE/2Zmbn8WzsDDxDzBAzxEKcmZ1xNP4izsyOIWaIGWKBm3E0VnFmVuNo7MSZWY2jsYozszLEDDFDLHBznRmn4sSZecd1ZpyKY4gZYobYD0RQL1bKLk86AAAAAElFTkSuQmCC', - blockedUsersList: [], - verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + '\n' + - 'wsBzBAEBCAAnBYJk7dERCZAIZdJAfLB6iRYhBK0xCN+/G/tf7pts7whl0kB8\n' + - 'sHqJAADd9Af/Z4DcYGZyQmVmIXM3CSDf2RaJOsEchm3hN93ErvTwGrKiviKW\n' + - '3/k6HWON3COHqmL5D1wlgZERTqaw3Xft1JC/82P108/IgDHiid4Wo4ojONn+\n' + - 'ZZV6KUfH1i0+wxXNsSvS1XtVYVnq/pQbXi8fzayCYM9jwdiFzBosQTLmXIbY\n' + - 'mUl1OezZ35kPQuZWjtZ2jyATQit6QL0uvQBiGAIevj1LRiB8uQsi0+Xr7R6I\n' + - 'D7WQ0Iwr85OIENGyv1KgrH/1Q944SjamWWI31gUhedH5a+THVLNDJGg3CAfq\n' + - 'FoOb2DNDviovMQxZwUOyCRCxVE6Ohw5Hwkw1YQOvzSwJRzz70l8A8w==\n' + - '=k8OV\n' + - '-----END PGP SIGNATURE-----\n' + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'update' } ``` -| Param | Type | Remarks | -| ------------------------ | ------------------ | -------------------------- | -| name | `string` or `null` | Profile Name | -| desc | `string` or `null` | Profile Description | -| picture | `string` or `null` | Profile Picture | -| profileVerificationProof | `string` | Profile Verification Proof | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | </details> --- -### **Fetch List of Chats** +### **Remove From Group** ```typescript -// List all chats -const aliceChats = await userAlice.chat.list('CHATS'); -// List all chat requests -const aliceRequests = await userAlice.chat.list('REQUESTS'); -``` +// Remove Members To Group +const addMemberToGroup = await userAlice.chat.group.remove(groupChatId, { + role : 'MEMBER' + accounts: [account1, account2] // these accounts should be a part of group +}); -| Param | Type | Default | Remarks | -| ------------------ | --------------------- | ------- | -------------------------------------------------- | -| `type` | `CHATS` or `REQUESTS` | - | Type of Chats to be listed | -| `options` \* | `Object` | - | Optional configuration properties for listing chat | -| `options.page` \* | `number` | `1` | The page number for pagination | -| `options.limit` \* | `number` | `10` | The maximum number of items to retrieve per page | +// Remove Admin To Group +const addAdminToGroup = await userAlice.chat.group.remove(groupChatId, { + role : 'ADMIN' + accounts: [account1, account2] // // these accounts should be a part of group +}); +``` -\* - Optional +| Param | Type | Default | Remarks | +| ------------------ | ------------------- | ------- | ----------------------------------------------- | +| `chatId` | `string` | - | Unique identifier of the group. | +| `options` | `object` | - | Configuration for adding participants to group. | +| `options.role` | `ADMIN` or `MEMBER` | - | Role of added participant | +| `options.accounts` | `string[]` | - | Added participant addresses | <details> <summary><b>Expected response</b></summary> ```typescript -[ - { - chatId: '6168440929ced5109c50534d40bb98a5e109ebf1d33df966ae898f002fac8973', - about: null, - did: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', - intent: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', - intentSentBy: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', - intentTimestamp: '2023-08-29T08:05:03.000Z', - publicKey: - '{"key":"-----BEGIN PGP PUBLIC KEY BLOCK-----\\n\\nxsBNBGTt9AcBCADXjt9OEXDQyE7w2veaHqTUN9fALt7c+cubz2nhWfmD07M1\\n5Spm3ScT/4HdlPpUBYnGUKlCT09g663RvvmDzp8442vZhfYeKbetrcNFxfnp\\n+ePQGiLDY0h2FmjQGkmZGP43ZLyhNT4eCIGPcPSpzaWAKw4wgE/tW2hli5m/\\n7e8HFno+bHp2ycNoPJpdqhY77CJL9zPqFdctCPxI5r1/+xkVLcf+NZ+vD7mz\\nq8xVpu3Tij5Jb5ShDPQ3qqPsqdCcB/fpnEtAOT/Ryuf5Qqic/bDrzImfaIO9\\nYmdnuc6uQBR1s8WbLHmOsQvJhe2D8MtggV5HwHbkPqxXBmpGIJnMeLHZABEB\\nAAHNAMLAigQQAQgAPgWCZO30BwQLCQcICZBvKHl019glPAMVCAoEFgACAQIZ\\nAQKbAwIeARYhBEyKE1gcoT4IIxerrG8oeXTX2CU8AADltgf/dREUaHmfMnwa\\nWwcoGxfya7xeSeqGLWoWsCDg55lq0rf59IFKw59AKL+4kKQrmVDW0x6oo844\\nxBv3NBq7OssNbRr4XYIXJN4oP8g0SdOYinTTcnHFjJcRHfTIa+lmlf7fwc7d\\n2DRW3Kyu66OGq9sLzcgI3Q4Fg3VOQGRDdVGF4zJGjPEpnHsJuGCVnbn5L94p\\nMZHEMIahYrYg2asglSByNUZIH+r0Y8rCzKp8rs37X/Q8RBrmW/oTnE/bb+xo\\n1jHgRR3MUs2Ea0oAqv/TwqpBRzMIWQ8tGKfEaJ22p02FJaE5q9KMbLp0mMIe\\nd33xGwOezLKoK5L9cHKg7wmz4sWvUs7ATQRk7fQHAQgApXcZbj43S5sr7v8d\\nq9JwcXkSdpRuzGw5zyauxUUElq2RLKPvsP8En+OJQceKWQcpvz16xLjnSoZI\\nfgIl1wXUaEb2T45rUrWmnoO+Csy2h6FePNmlHOerY2/C0GHQX3XP/B0t41By\\nG/o4losESsBaHEYugHIg5kXhgsGnlgoC3Bu4zHFmIvLlZXjCWYUG2JnhNHlG\\nrD67/Xuox1FO+Hh/rR7sSsWIH6S+SFgG/P4bwiW0JAYQP6bC4tbXfzvKJk2R\\ndeySnppEAwdn/3lCU5QscYIIUXSaPoV3Q6hg+wRigBk2ixkqdOTJmJROTOo3\\nUdnaeGSwP23USJIUncZWgcIokwARAQABwsB2BBgBCAAqBYJk7fQHCZBvKHl0\\n19glPAKbDBYhBEyKE1gcoT4IIxerrG8oeXTX2CU8AABx6Af/XRamjQ4T79rf\\nhNArQt3VuHvpIUP860MCg0aW5rMtZ8q4+TwOyjiEgOUIFx215Yprb3R3NTKV\\nQWJr8n++ZGDmQ8iro8nrRMRELmoEJzyWp3yr0dyr2lx01//bud+vVw+ARPLt\\nVUnX8eguLKRrltQmIRwCqX01PCTiN2RDB2Akd+zlBGRiHoavW9dDdGGBY9wW\\nA2Pyw73BeMzVA3akiGzLsdRIshO0DBALaX0G5ytqyIf3QjXOqO6C7gp9XW7R\\njXhRhzvR9NjZPmSXEeYqYw2CUPxzaLsKoSP4dbXE7Hl+sYJptzke7LE1StzH\\nG64gRgEYMCKvRZaPXYnPJXAZwDhijw==\\n=8aQd\\n-----END PGP PUBLIC KEY BLOCK-----\\n","signature":"DEPRECATED"}', - profilePicture: - 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAsklEQVR4AcXBQY0DMRBE0Z+SCRhCsBhGAJiAYQwBgzGmZuDk2pPDSKPsqt57zNfzTVKPxX+K0ciEmTATZqXuSRajkdVjkcVoXKnHIovRyOqeZMJMmAmzEurcUffkF6FOJsyEmTAr3BTqXKks7hBmwkyYFb7UPflLdU+yUCcTZsJMmBW+hDong5O6J1diNE7EJWEmzIRZqccii9G4Eur8oh6LTJgJM2H2mK/nGyNhJsyE2QfJZChdHLm7QQAAAABJRU5ErkJggg==', - threadhash: 'bafyreiewla5iyd7rnvjw2c5w6dbab4zkyf2desbowzouijoea2jzakxz6i', - wallets: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', - combinedDID: - 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562_eip155:0x84a9385e9b97df87b80c2e689997133703853874', - name: null, - groupInformation: null, - msg: { - fromDID: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', - toDID: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', - messageObj: [Object], - messageContent: 'Hello Alice!', - messageType: 'Text', - timestamp: 1693316103747, - fromCAIP10: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', - toCAIP10: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', - encryptedSecret: - '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMA3d9z8TNUuddAQf/U2hMcybh5mUt9FFen5tfZ52PaB0vc2G+wYYIsBfu\n' + - 'zg58rgLy8uGMxvzhtCWhpIE91G62d8M4OmaDa+PLjs8SqyRoyih/9pt8P4cw\n' + - 'UJVHHDcJNC9r6/AV4aZySdz5u5utE7o3iB1FU0Sr9HEQsImmOM7J6LZJ3xWJ\n' + - 'V+o4ToLbqUFYKg2uY1kUXpyX+D6JRinagnAosh4zCICLUqrEkKNqbyV2mr+5\n' + - 'FK+fClWBGCwpf38L220FqHYPQ4bQXks0N07yW4OVjVpCTZVuNttr7PIEqcyZ\n' + - 'qIovbQbkltiDpsb/yYysEHTwBtvugna7xMW7SRY34x3iWm/HBNJmfBG7LnjI\n' + - '6cHATAMrTKobmmcFTAEH/20nW6aNzfj1vn/5GIWjZ5Z4Rw6G3Syt+0NxPUix\n' + - 'dpKIFOR0/BEJkafGMdlk/vRElsyluKbzykBlIQ0hHGRpGMNEW8s8GrJeiXvV\n' + - 'JSNZ24u5DDk8DIBaJWJnyWM7XzgcmOmn9rvVbvc9qgNNgtDeMIZwUpiDipnA\n' + - '++7n72h0JSs8dWFQ62FSf5ACHC0UVbPiL3TRrRBEo7vQp4JsJyXp70CUclqU\n' + - '3ANLvNhINV6GGtpXEKnsBVkkg35HR92nIzk+8HL86SsRUYfXkufzXdkPpmRn\n' + - 'SG7MoDecNf/bwoqP8/l2X2h3R1c+WTQFb6Z+eK/NsJ/AnSErFZh3yEHAi1Rz\n' + - 'yIXSQAEA2KupLnBVC9fqZqhUySvOW/Hs/hD6iEEGIl+U/RC9AwdG2jpg4sVi\n' + - 'f9PhBJ5Tanynb3aHngRKtIzjP5m223A=\n' + - '=5w+B\n' + - '-----END PGP MESSAGE-----\n', - encType: 'pgp', - signature: - '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7fQHCZBvKHl019glPBYhBEyKE1gcoT4IIxerrG8oeXTX\n' + - '2CU8AACRLQf/bbeJoUNwRkJYz100R3ULO27HGjKnFeOaMZWRNF8JqWzNmCBL\n' + - 'Cj3aIBkDuCUj7avBsanScbSa7tD8Mc8PZgpSkd22nNH5iHiDJqlPtySJ2KoZ\n' + - '3ekVXfOgfLlHtN78ghTxABewYQRuB6kwtv3XQW8X9sCL2jEF4NIIl5eXZvIT\n' + - 'nhbHhhOR47k2E0hiHjPv2t3ggrwkrw6ISDgV8qYcrnf7vEFeGHpeSc25QLJH\n' + - 'pXCeeHhH7h4C9L3PEdMt8T+Ne36cfNiwTGdOavin/yfNES6k0kqZxP44hn1M\n' + - 'ZBk4jfyaDUh70mv4FtxdPcdb1TGQsPC1YYAIh/059EBqkdJFhVF4+A==\n' + - '=DBch\n' + - '-----END PGP SIGNATURE-----\n', - sigType: 'pgpv2', - verificationProof: - 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + +{ + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + '\n' + - 'wsBzBAEBCAAnBYJk7fQHCZBvKHl019glPBYhBEyKE1gcoT4IIxerrG8oeXTX\n' + - '2CU8AADsmwf/UpJCmnqztJLt1Ltg0OD7xoDvumitRwkfhnXzUdBWxM3i7vj4\n' + - 'cfjtcpQI2R5W0TXj9e2fymimIc98kjUqpDiUIaVAuD0OnEbJdIluGLBTJeks\n' + - 'YTRikqkgjFJT9Y6/2VRQj59IR0rgC0sec8mSKPlxuhixkdSS7Wec0+84cGmX\n' + - 'aieskReKeitKacYkU4Uf82Klc7Ft8+duBsaMGR3TS22PzHfYIHmy+8Z3b1SK\n' + - 'pMyJ8NBXCG2F+05WdoUsXBR+lO74RjSDWnWZlgRngWjjvSXQuZ/QznIyBVmQ\n' + - 'oOxJM5LSCCwH6ch5J/HmXudJG+3wsCINchvSQx0LntZUoeSp8cezvg==\n' + - '=KUqZ\n' + - '-----END PGP SIGNATURE-----\n', - link: null, + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null }, - }, -]; + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'update' +} ``` -| Param | Type | Remarks | -| ---------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------- | -| msg | `IMessageIPFS` | message object | -| did | `string` | user DID | -| wallets | `string` | user wallets | -| profilePicture | `string` | user profile picture | -| publicKey | `string` | user public key | -| about | `string` | user description | -| threadhash | `string` | cid from the latest message sent on this conversation | -| intent | `string` | addresses concatenated from the users who have approved the intent | -| intentSentBy | `string` | address of the user who sent the intent | -| intentTimestamp | `number` | timestamp of the intent | -| combinedDID | `string` | concatenated addresses of the members of this chat (for DM the 2 addresses and from Group the addresses from all group members) | -| cid | `string` | content identifier on IPFS | -| chatId | `string` | chat identifier | -| groupInformation | `GroupDTO` | if group chat, all group information | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | </details> --- -### **Fetch Latest Chat** +### **Join Group** ```typescript -// Latest Chat message with the target user -const aliceChats = await userAlice.chat.latest(bobAddress); +const joinGroup = await userAlice.chat.group.join(groupChatId); ``` -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ----------------------------------------------------------------------------------- | -| `target` | `string` | - | Target DID ( For Group Chats target is chatId, for 1 To 1 chat target is Push DID ) | +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ------------------------------- | +| `chatId` | `string` | - | Unique identifier of the group. | <details> <summary><b>Expected response</b></summary> ```typescript -[ - { - link: 'bafyreibfikschwlfi275hr7lrfqgj73mf6absailazh4sm5fwihspy2ky4', - toDID: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', - encType: 'pgp', - fromDID: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', - sigType: 'pgp', - toCAIP10: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', - signature: - '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBQJjh5tjCRBaJmgmByp5FRYhBJC23yBJT2d/pTAID1omaCYH\n' + - 'KnkVAAAZmwf/buPLw6caSZmYnw6D3/p6HF1kWlkGUOTP4RasaU/6dkeDaZs9\n' + - 'SJlz2wC8oOpBGWHMJ/5n3ZWmU71E6U7IKIY793MyIv5t32vTNkwsRHUX7IIn\n' + - 'QFF+FzTIEtHHVTRlnkqNR2YUk1kqcpZCZWHfahi5W2d/WkXlFNdvyyFH4W8L\n' + - 'd03FGhOyXbWwU3xicBz5mSBpIFaaSCXl1SdgJDPXLSk3b65EEOjCOaiz85xC\n' + - 'G+6SW4RUzCGSDcOd9F2EXvvY5H9LgQNi1jjlZn6JrPTPJTJ+wXZXzcZmtOXG\n' + - 'EKcwvPbbPY9wd+gavRSOgYLYn5xoZQW/o3hW7AQlbC5Kj6js48Z0HQ==\n' + - '=qLiJ\n' + - '-----END PGP SIGNATURE-----\n', - timestamp: 1669831523684, - fromCAIP10: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', - messageType: 'Text', - messageContent: 'Hi', - encryptedSecret: - '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMA1fn1CNqxQ7nAQgArlo75qe54WerfRKFv1+F9j4NRMvSTgUztvIe51eg\n' + - 'd5MVuj6RYxKERr2bTuBt5cMDJMlNuTnBBkPe4L8+SlsI46L9wmXV9xLoZq1a\n' + - '94JdxD98RGMF99Jde/3hC/X6GS1yVqPpKPKdWx/tkOPeyqeO/wFF7kqShgIi\n' + - 'Wgq6hGz1fzD3GZhKGY0VSLuC3s0aUy/qw5En1Xd0uX0jdXBl07IIj8p1G2zx\n' + - '9BuVlksSK34yvIc0RQfCeRadMHkxbA0Hyj31Wrr+Y310YLTppL0s5bQR9APL\n' + - 'WHsIztJ1fHTnXsPhnA7YG0SQpHTyJhuX3rgBjxGrvbZBArmZ+R/Pq9IkOkJe\n' + - 'z8HATAMOsbaZjGN5JwEH/jYjLN6AFRWeaB5CSBSAF+CvHsUgadGmxTdSHBM6\n' + - 'LM9rfGg/MCnpRBuHckA0NNZh+wepq6TDA54ZopsdP14gHj4MKCdfqZr86Jft\n' + - 'ldtjeSgPTFEEJxPMJ4/Z3UeFU9rvOgfxX6l0eHWS0MYwJ3sVYvSyqqHir1K5\n' + - 'TRdEIgtQ3NvLTKkX4bKTSU+SInrvDA+wsc2BcBsbgNhRiGb+XYrbqXBshL1a\n' + - 'lIdpnomkAQgOZMO2n347uURYoruH3OtFeNABJ9D/nEU+LdhDOPGZPefvPBc5\n' + - 'BxK4ExKZ2Wo/TZw8lgC53uqOljsGV63Hp71LkyesKWu5/+vdVrYx/vU63shh\n' + - 'x/TSQAEiaFYEfkWSOthtH0nrJHhkY7FWgjp/1bj/J4J9HCQrVtt2WlQfhowZ\n' + - 'ILxhKk/vep0sJviM3SfJ4hPtoYpZESc=\n' + - '=43Ta\n' + - '-----END PGP MESSAGE-----\n', - }, -]; +{ + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'update' +} ``` -| Param | Type | Remarks | -| ----------------- | -------- | ------------------------------------------- | -| `fromCAIP10` | `string` | sender address | -| `toCAIP10` | `string` | receiver address | -| `fromDID` | `string` | sender did | -| `toDID` | `string` | receiver did | -| `messageType` | `string` | message type | -| `messageContent` | `string` | message content | -| `signature` | `string` | signature of the message | -| `sigType` | `string` | signature type | -| `link` | `string` | content identifier of the previous messages | -| `timestamp` | `number` | timestamp of the message | -| `encType` | `string` | encryption type | -| `encryptedSecret` | `string` | encrypted secret | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | </details> --- -### **Fetch Chat History** +### **Leave Group** ```typescript -// Chat History with the target user -const aliceChatHistoryWithBob = await userAlice.chat.history(bobAddress); +// Leave Group +const leaveGrp = await userAlice.chat.group.leave(groupChatId); ``` -| Param | Type | Default | Remarks | -| ---------------------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------- | -| `target` | `string` | - | Target DID ( For Group Chats target is chatId, for 1 To 1 chat target is Push DID ) | -| `options` \* | `object` | - | Optional Configuration for fetching chat history | -| `options.reference` \* | `string` or `null` | - | Refers to message refernce hash from where the previous messages are fetched. If null, messages are fetched from latest message | -| `options.limit` \* | `number` | 10 | No. of messages to be loaded | - -\* - Optional +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ------------------------------- | +| `chatId` | `string` | - | Unique identifier of the group. | <details> <summary><b>Expected response</b></summary> ```typescript -[ - { - link: 'bafyreibfikschwlfi275hr7lrfqgj73mf6absailazh4sm5fwihspy2ky4', - toDID: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', - encType: 'pgp', - fromDID: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', - sigType: 'pgp', - toCAIP10: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', - signature: - '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBQJjh5tjCRBaJmgmByp5FRYhBJC23yBJT2d/pTAID1omaCYH\n' + - 'KnkVAAAZmwf/buPLw6caSZmYnw6D3/p6HF1kWlkGUOTP4RasaU/6dkeDaZs9\n' + - 'SJlz2wC8oOpBGWHMJ/5n3ZWmU71E6U7IKIY793MyIv5t32vTNkwsRHUX7IIn\n' + - 'QFF+FzTIEtHHVTRlnkqNR2YUk1kqcpZCZWHfahi5W2d/WkXlFNdvyyFH4W8L\n' + - 'd03FGhOyXbWwU3xicBz5mSBpIFaaSCXl1SdgJDPXLSk3b65EEOjCOaiz85xC\n' + - 'G+6SW4RUzCGSDcOd9F2EXvvY5H9LgQNi1jjlZn6JrPTPJTJ+wXZXzcZmtOXG\n' + - 'EKcwvPbbPY9wd+gavRSOgYLYn5xoZQW/o3hW7AQlbC5Kj6js48Z0HQ==\n' + - '=qLiJ\n' + - '-----END PGP SIGNATURE-----\n', - timestamp: 1669831523684, - fromCAIP10: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', - messageType: 'Text', - messageContent: 'Hi', - encryptedSecret: - '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMA1fn1CNqxQ7nAQgArlo75qe54WerfRKFv1+F9j4NRMvSTgUztvIe51eg\n' + - 'd5MVuj6RYxKERr2bTuBt5cMDJMlNuTnBBkPe4L8+SlsI46L9wmXV9xLoZq1a\n' + - '94JdxD98RGMF99Jde/3hC/X6GS1yVqPpKPKdWx/tkOPeyqeO/wFF7kqShgIi\n' + - 'Wgq6hGz1fzD3GZhKGY0VSLuC3s0aUy/qw5En1Xd0uX0jdXBl07IIj8p1G2zx\n' + - '9BuVlksSK34yvIc0RQfCeRadMHkxbA0Hyj31Wrr+Y310YLTppL0s5bQR9APL\n' + - 'WHsIztJ1fHTnXsPhnA7YG0SQpHTyJhuX3rgBjxGrvbZBArmZ+R/Pq9IkOkJe\n' + - 'z8HATAMOsbaZjGN5JwEH/jYjLN6AFRWeaB5CSBSAF+CvHsUgadGmxTdSHBM6\n' + - 'LM9rfGg/MCnpRBuHckA0NNZh+wepq6TDA54ZopsdP14gHj4MKCdfqZr86Jft\n' + - 'ldtjeSgPTFEEJxPMJ4/Z3UeFU9rvOgfxX6l0eHWS0MYwJ3sVYvSyqqHir1K5\n' + - 'TRdEIgtQ3NvLTKkX4bKTSU+SInrvDA+wsc2BcBsbgNhRiGb+XYrbqXBshL1a\n' + - 'lIdpnomkAQgOZMO2n347uURYoruH3OtFeNABJ9D/nEU+LdhDOPGZPefvPBc5\n' + - 'BxK4ExKZ2Wo/TZw8lgC53uqOljsGV63Hp71LkyesKWu5/+vdVrYx/vU63shh\n' + - 'x/TSQAEiaFYEfkWSOthtH0nrJHhkY7FWgjp/1bj/J4J9HCQrVtt2WlQfhowZ\n' + - 'ILxhKk/vep0sJviM3SfJ4hPtoYpZESc=\n' + - '=43Ta\n' + - '-----END PGP MESSAGE-----\n', - }, - { - link: null, - toDID: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', - encType: 'PlainText', - fromDID: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', - sigType: '', - toCAIP10: 'eip155:0x0F1AAC847B5720DDf01BFa07B7a8Ee641690816d', - signature: '', - timestamp: 1669831499724, - fromCAIP10: 'eip155:0xb340E384FC4549591bc7994b0f90074753dEC72a', - messageType: 'Text', - messageContent: 'Hey Fabio!', - encryptedSecret: '', - }, -]; -``` - -| Param | Type | Remarks | -| ----------------- | -------- | ------------------------------------------- | -| `fromCAIP10` | `string` | sender address | -| `toCAIP10` | `string` | receiver address | -| `fromDID` | `string` | sender did | -| `toDID` | `string` | receiver did | -| `messageType` | `string` | message type | -| `messageContent` | `string` | message content | -| `signature` | `string` | signature of the message | -| `sigType` | `string` | signature type | -| `link` | `string` | content identifier of the previous messages | -| `timestamp` | `number` | timestamp of the message | -| `encType` | `string` | encryption type | -| `encryptedSecret` | `string` | encrypted secret | - -</details> - ---- - -### **Send Message** - -```typescript -// Alice sends message to bob -const aliceMessagesBob = await userAlice.chat.send(bobAddress, { - content: 'Hello Bob!', - type: 'Text', -}); +{ + members: [ + { + wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + + 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + + '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + + 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + + 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + + 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + + 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + + 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + + 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + + 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + + 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + + 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + + 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + + 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + + 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + + '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + + 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + + 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + + 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + + 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + + 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + + '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + + 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + + 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + + '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + + '=9hCc\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: true, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + } + ], + pendingMembers: [ + { + wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', + publicKey: null, + isAdmin: false, + image: null + }, + { + wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', + publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + + 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + + 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + + 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + + '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + + 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + + 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + + '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + + 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + + 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + + '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + + 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + + 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + + '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + + 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + + 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + + 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + + 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + + '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + + 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + + '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + + 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + + '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + + 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + + 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + + '=qtAv\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n', + isAdmin: false, + image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + } + ], + contractAddressERC20: null, + numberOfERC20: 0, + contractAddressNFT: null, + numberOfNFTTokens: 0, + verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + + '\n' + + 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + + 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + + '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + + 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + + 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + + 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + + 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + + '=c6IF\n' + + '-----END PGP SIGNATURE-----\n', + groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', + groupName: 'influential_maroon_gamefowl', + groupDescription: 'urgent_brown_butterfly', + isPublic: false, + groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', + chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', + meta: null, + scheduleAt: null, + scheduleEnd: null, + groupType: 'default', + status: null, + rules: {}, + eventType: 'update' +} ``` -| Param | Type | Default | Remarks | -| ---------------------- | ---------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------- | -| `recipient` | `string` | - | Recipient ( For Group Chats target is chatId, for 1 To 1 chat target is Push DID ) | -| `options` | `object` | - | Configuration for message to be sent | -| `options.type` \* | `Text` or `Image` or `File` or `MediaEmbed` or `GIF` or `Meta` or `Reaction` | - | Type of message Content | -| `options.content` | `string` | - | Message Content | -| `options.action` \* | `string` | - | Message action ( Only available for Meta & Reaction Messages ) | -| `options.reference` \* | `string` or `null` | - | Message reference hash ( Only available for Reaction Messages ) | -| `options.info` \* | `{ affected : string[]: arbitrary?: { [key: string]: any } }` | - | Message reference hash ( Only available for Meta Messages ) | +| Parameter | Type | Remarks | +| -------------------------- | --------------------- | -------------------------------------------------------------- | +| `members` | `Array<Object>` | An array containing member objects. | +| `members.wallet` | `string` | The wallet address of the member. | +| `members.publicKey` | `string` | The member's public PGP key (if available). | +| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | +| `members.image` | `string` | Image associated with the member. | +| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | +| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | +| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | +| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | +| `pendingMembers.image` | `string` | Image associated with the pending member. | +| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | +| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | +| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | +| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | +| `verificationProof` | `string` | Verification proof associated with group data. | +| `groupImage` | `string` | Group's image. | +| `groupName` | `string` | The name of the group. | +| `groupDescription` | `string` | Description of the group. | +| `isPublic` | `boolean` | Indicates whether the group is public or private. | +| `groupCreator` | `string` | Push Profile DID of the group creator. | +| `chatId` | `string` | Unique chat ID associated with the group. | +| `meta` | `object` or `null` | Additional metadata (if available). | +| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | +| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | +| `groupType` | `string` | Type of the group (default, spaces, live etc). | +| `status` | `string` or `null` | Status information ( active, expired etc) | +| `rules` | `Object` | Group-specific moderation rules | +| `eventType` | `string` | The type of event (create, update etc) | -\* - Optional +</details> -<details> +--- - <summary><b>Expected response</b></summary> +### **Reject Group Joining Request** ```typescript -{ -fromCAIP10: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', -toCAIP10: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', -fromDID: 'eip155:0x84a9385e9b97df87b80c2e689997133703853874', -toDID: 'eip155:0x14727F96dF61105661E78275D1A03C4F8aeff562', -messageObj: 'U2FsdGVkX1/S1wljx7jN0NXJzSNoJCkg/6cw7gHwVibLsqyhpe/XgzJi7OUrXwUh', -messageContent: 'U2FsdGVkX19oSSMVZpQdw+jZRExfd1GvJkIwgWAGe5g=', -messageType: 'Text', -timestamp: 1693316104031, -encType: 'pgp', -encryptedSecret: '-----BEGIN PGP MESSAGE-----\n' + - '\n' + - 'wcBMAytMqhuaZwVMAQf+KkUcX1rmNnorm0bCeGPknnjMBFn2wQ4nIAbQV5cW\n' + - 'W7bCHneK0V0+kpronJwuPb8e8GUZiJEmJGdTJYf3XMVP8sJkVVVQEbvYvAJL\n' + - 'tUEsdqgqRuqGB+u4k5shtlHN1ViTjjc1N97C0eQUqTCVFKa1Ul9eZirhDqiI\n' + - 'C/rj8uxESy+NH7o/nnbGTlwQonOOLLHfGH2zCpl/F59CO2CcLnuecfDT0WxJ\n' + - 'xi2hM/ovKgbsKVI8WOOde0sIV3MQEvxAFuPJ8gINpoDA28Ty+lf7x1bN9ONN\n' + - 'RZl4yjLpA7KUojWyfjp1/UW635NY11aZYEXIygDppCCvf6AE7je+1FDaVR/B\n' + - 'I8HATAN3fc/EzVLnXQEH/1H4r6FubywzPzRlDJzPgxyNpNGPZbexrWRQT5U4\n' + - 'eHmh7EsOfEattUCHb8zChL8crnX0CCw9MiN/ryfs9PXXK2qP3lFU59GUHd9q\n' + - 'Mz3RQwF76M9C8zbsoUymIPXUypBBma/qsF8MK54qYoVPody6T3u7bEfW6E8r\n' + - 'nDtlz62+G6wk4sNE7iJsk6KhGmb1t9v/j1qgmJwuE7zGP0QjSuquJsfkzUot\n' + - '1eU85XnUTGdoYBR2u5F2TsjIHn1ex2R0sZYfdc9eRNSSvDHrce9m7R5p7Y5F\n' + - 'sSs96Skx7wLuepGt/vY2cH9Mq3AEGaXREV2NSr453+gHeTupp3aIiQ2CDpFB\n' + - '/MzSQAHCPW1DUf8r1cFE1Y1RXU15gNBeFju/ZBnpDlTbj3xXi0shafcl59pe\n' + - '0LTGhdDSYPX0Rs6zqJgex20XBnfgPD0=\n' + - '=ycNl\n' + - '-----END PGP MESSAGE-----\n', -signature: '-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7fQICZASd4ccCgkrMhYhBGLo0VO3qtKBG9Y0eBJ3hxwK\n' + - 'CSsyAACktggAr3mI2uwn4m4sI7m8A8wIRgjs6h8V7d2feLsdqV7QL6aUzYld\n' + - 'bewZYKQjSXdnklRtnlCIG1jmqFOCycv++3O5jcWY+du8lR912Gkjn0PDN/wW\n' + - 'jSBDTkH0IKmIrYqIDnfbxYoUfUxAWXzm8N0LgVnA+qgs1CYzcS8S38zAONvH\n' + - 'GBl8ZXNTgY5HYN3Pk74wms5jhBF1J7mtfMCNN8k7VHFaoC6YVF1REhwrSlxx\n' + - 'l4bajYkJJMWfKdiQWQ31kSHChzKXBhu2rIWJ6A7ijyoc7Ff0s4xgwm/3cLQc\n' + - 'hrlBpkMKI2xCDnP10Sr1sgmG7ropd+tCOFwsoEWqFqt+kJ592+g1mw==\n' + - '=TVDb\n' + - '-----END PGP SIGNATURE-----\n', -sigType: 'pgpv2', -verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7fQICZASd4ccCgkrMhYhBGLo0VO3qtKBG9Y0eBJ3hxwK\n' + - 'CSsyAAA8/Qf/Qvcom0DtPUQAOWkM+FCeBttjkCiM/ekZa1Gxioyy7jT0Baoi\n' + - 'oUi8y4BpmjKjCvUGCDovcvvnjeLW8gpqunN/LOx1c4mPsgFTU0IQFqZmTtZK\n' + - 'KMa+p/uiTXNnwx9635FV8WLOWQoyJP+u76rTu8n2YU1+5+N7xan9Wl+yuu4d\n' + - '/WkFwAq/WQjW4cgIZ08OWfNGaOh6kt3ceCvR25XVbb8gdMPOj262d7RuWVqs\n' + - 'L31XJ8U/EkKZN5AxIB7AP6HKhZhlV6qbgizVFskWefT4E3Qq+9WLn4ApHf2R\n' + - 'OksjHVbukZNbXrWeMjbZE9RlswPCXM68WsxWe1zItjXs63w1mwoQZg==\n' + - '=e9QO\n' + - '-----END PGP SIGNATURE-----\n', -link: 'bafyreiewla5iyd7rnvjw2c5w6dbab4zkyf2desbowzouijoea2jzakxz6i', -cid: 'bafyreibhnilz634i55hdkrkp3j4vt76dnyegvmrezdiuykeizq7unvx7cy', -messageCategory: 'Chat', -messageOrigin: 'other' -} +// Reject Group Request +await userAlice.chat.group.reject(groupChatId); ``` -| Param | Type | Remarks | -| ------------------- | -------- | ------------------------------------------- | -| `fromCAIP10` | `string` | sender address | -| `toCAIP10` | `string` | receiver address | -| `fromDID` | `string` | sender did | -| `toDID` | `string` | receiver did | -| `messageObject` | `string` | message obejct | -| `messageContent` | `string` | message content ( deprecated ) | -| `messageType` | `string` | message type ( deprecated ) | -| `timestamp` | `number` | timestamp of the message | -| `encType` | `string` | encryption type | -| `encryptedSecret` | `string` | encrypted secret | -| `signature` | `string` | signature of the message ( deprecated ) | -| `sigType` | `string` | signature type ( deprecated ) | -| `verificationProof` | `string` | message verificationProof | -| `link` | `string` | identifier of the previous messages | -| `cid` | `string` | identifier of the message | -| `messageCategory` | `string` | Category of message ( `Chat` or `Request` ) | -| `messageOrigin` | `string` | `Self` or `Other` depending on the receiver | - - </details> +| Param | Type | Default | Remarks | +| -------- | -------- | ------- | ------------------------------- | +| `chatId` | `string` | - | Unique identifier of the group. | --- -### **Accept Chat Request** +### **Fetch Encryption Info** ```typescript -// Accept Chat Request -const bobAcceptAliceRequest = await userBob.chat.accept(aliceAddress); +// Fetch Encryption Info +const aliceEncryptionInfo = await userAlice.encryption.info(); ``` -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ----------------------------------------------------------------------------------- | -| `target` | `string` | - | Target ( For Group Chats target is chatId, for 1 To 1 chat target is Push Account ) | - <details> <summary><b>Expected response</b></summary> ```typescript -// Combined DID for Chat -eip155:0x7a38D295786d1480BAab4a63b8d85B5a47bA4b78+eip155:0xcCC0Cc5081A135E4269E82907d2dAD6728ea4159 +{ + decryptedPgpPrivateKey: '-----BEGIN PGP PRIVATE KEY BLOCK-----\n' + + '\n' + + 'xcLYBGTvQKUBCACgsuLM540Bq39fAbLRGoaRZR5/lETkpQSArzP4+B+wxcQe\n' + + 'IItuLF9z1+OHilx/uAJ6yWH2En8QdlSBRMDCSwhLOXYnrB5dTvEM2nm+v59H\n' + + 'sIRkRUogXSIgTrcVG7Tt0JsrjBV2avOki1L4vzPvHEDUtlKcxdJ5914W2lSu\n' + + '05xPG+ALRsYFki1ga6bt6kT1+v7GV+862hOHY/FugohLKdIZOo6CeI0ddnHF\n' + + '9jL3pu4aTRn11VIphju3KQ2oCxF/6843OrA4X/GtVtsoRq00RBLuv61ZmRpr\n' + + 'qsOgEz009cDEWdUWs8wvf75TG/MfYM4g+9nSWflJGMSD3PfVHKTzOsYlABEB\n' + + 'AAEAB/0d/GNPwuFP73VsAAAi/qUfmlPPkJYuaBBoBslW6s3XCYAn8wCxhTwm\n' + + 'fKFrWEkcV/S2fr910Eu/gaURHggt+RxKFSXUD0z3MlTOhjHzgwQwt2Js53UG\n' + + 'hvpoNuf421uuiJ97x771gs2F5a2M1vjU5FvAlWji8hLtSVhYQVNN8BSZuhkK\n' + + 'Adq+/MsHmOvD6YkBW2xuAGo1ZVF4D8JUJDUWcjRJCMr0gJJv34c8f74EYW8b\n' + + 'LhrLGZgPRBkJemmN08sVwW5NLlPwjHTrvZOcb9RQ/N3liBwamk13dIEMNil1\n' + + 'GjGI6txtd04SXN0nTq2e+v+n8jk3HgwM3ypTAbaO+XQSBWyhBAC/mIv9OK7t\n' + + 'RoNA42+nJU+SYLEFFDew6x0b6Yg8k44gSiWiYadRWpDRP/essz641W1Ksn0a\n' + + '02kx+m55tT6uQFFwly24FOaFexhfvhbKtmA+sfJtvQVNebgH/2EJn9QSti/y\n' + + 'rGBStwDs48Psb2ZtcNNwhYajTACLioEF/vgx7FhKbQQA1reKmY5TefRFEK0b\n' + + 'lBqkDyYZoLKxEAoXQ6IwrVbIdO2kvPVDjfAy1CqpCnDhzXdXYmHA3HHOPJgr\n' + + 'PkLc8r0MeZR7ZI67JSSFoP2ixlxJjI06vXjQVvzrCigSJfL24LaBXBjQtd8t\n' + + 'X+g4KpM+a5iGrE1dQ/dgCt/G97Ra2v7Ql5kD/01W5Q+NqXxb++YrTJOXaNhp\n' + + 'yfSWYqtf62/xMoRBY8n/jtmyVD88i61aoqRsTDy+6Ugoi9QkrzhL7PSgn6Gl\n' + + 'yy5whksUFHFIcXDGF0HtPLIuEUJ7V3tC9yZ8Q630o3Dirf1+tP6+aLoMLwb2\n' + + '5O+SZFQk4cAVvW4aKbyGPdhlDvYxPkPNAMLAigQQAQgAPgWCZO9ApQQLCQcI\n' + + 'CZD+BWKBkBMI0AMVCAoEFgACAQIZAQKbAwIeARYhBEXCtUQEMuKbuZLzrv4F\n' + + 'YoGQEwjQAAC0VAf/VNnQ5xfPHhm6JfZ+cH2lUfy65pZ+5GqXHanB9RcxZPHe\n' + + '9hzr0l1IJk4o48HUrIcwJhpBfXUsd9oLC81Un1io0uX37hE3in+ND4j11ZiR\n' + + 'e8kQakH67/R7XKUaD3JTfXTshVpWhVTa1mjBZZcxOzr8ZxhnuaSQ7888t5cF\n' + + '0zBuOo6YPmqiNVudlXlhXuiAVqp+xK5yamqxW9drz767aXUAvE9GChE4+P0i\n' + + 'a1wwvvA2wkZTE2+rJKvAWA8iit4TeOTTDJoja0zc2yKxytdeOy6PWr6lGjjb\n' + + 'zJEq9uqs1tx8znRosDkb+Gw26CHdUo2uVUDGkcesqxNUv+C/4R9eubBVYMfC\n' + + '2ARk70ClAQgA38Hi0a1rqZAPdBaUnlqY4x4pIi2KyFPQ7TmW3Y/V1NgEm9Y8\n' + + 'w3bx3TF8O8uDETn6U5ASUa2DG4gppcZrDqFsChnxhHOdJhEgh3X8LeyzuCHn\n' + + 'qWQPbo2iCt3ve0fRsK/f0ZPABgCqlgTGkeVi7KppUqB1FtkRMfh0Eqr3fLC9\n' + + 'pNRLtlnQT793rfavvXavK+0eeukZVPYbALuJq2tX0IBwr9+/6YEzSi7yo/1P\n' + + 'pRZSRSM9KQwk/R2ohS2FAytUpTRp/4OFIJqv93PxS7MlHVfe/lhc9fXeTvH2\n' + + 'sMQCfMsp16wP7Em+AjT5elJgXv3VrQ4whrr5yGfTvO9uQVoV7LKoWQARAQAB\n' + + 'AAf7BXspAJiiTGQnYsE6WQIwYFDg8lHCBmv6MFNysQD43JbBjyUxdhrL7C6O\n' + + 'A+N1dZaxXXpoHnjU/zfHyGQqw3AcFsfBqSxRV0lAXh0bZS8ZDGvFMlqtf5hn\n' + + '1aMP3pnY5r56Kba4M5Vw2E2r5Q9Ey/YVMCVW1O1SjOIwirQGLbdhH+BZMvcf\n' + + 'iAJ2fbQ919cX3CuATJnMs1/4Q+7dzPcksE1SON6eGeixrzXAr1y/Ls04wx9/\n' + + 'DXsXyPunzNDVdZPttEbpNcWv3gZ9MHpYIYbC3kbuopC7ICvW4pkSGkl+uiV8\n' + + 'iqoi+AxjgCvXSq+eVI11sZJ+Rjqi7M9yW5qjxzw2Wy25sQQA6Jm1+nXwo0UX\n' + + 'NagosTXSf++9CDraFdbbpz2HUX8B6Ls8HwTMQ7q/EZRqmjKqeT/BxVQVp+O6\n' + + 'WNMtpnGMUQrbDI6Tcu6C3kVhZg/R9dWpRigsOHnsySrI74nYh9DBISAkabCf\n' + + 'cqir7V7treB5vcIaS80ys1vFHgtuLtTgFisCfpEEAPZEb0rbQ5PR5yTBvE80\n' + + '0MW3OnNDqZ8905GHJ6IGJVOuQuDQfMoZ+06757IwrWrQ6mZk5WIyiHD31+tr\n' + + 'd58MP351/0wv1/WUkPEcwuxWuTIK1kKtwQkcl75wZbnqvAGOigAFlvOTNPnD\n' + + 'qZVODWmod1Yg0dLIB3HF/xV29nx5ngFJA/9ifa68aMeoZqd3CePMS3zUwyLy\n' + + '6ZZ2cnUuBLjf87Fl9Rl+OLPMryEwA24I6ybcaa01ZsUgG2SZIwkKAovEhgmJ\n' + + 'll5mXY9GNpULHj9fr2KyLkweFnvyTwIpv0VlT7WzEthebIM0hC0eSJyNmu2C\n' + + '/SQTKvYUIcwP3v1RMFsCNPV1dTy+wsB2BBgBCAAqBYJk70ClCZD+BWKBkBMI\n' + + '0AKbDBYhBEXCtUQEMuKbuZLzrv4FYoGQEwjQAABMkAf/UKvQHe+oYH/hU0/p\n' + + '7OXUMCKIzSHD9c7lrb2nnP4CGyxF+FoZbQ9qnMVuT6FX6zPyZgDtOjp8Grvc\n' + + 'ACBibxwujfnNdKBdA1r0XQGf2ht3BWYpgn9jGYw58bf3yaxr6/Dg1D7FzgbN\n' + + 'FkaarU8C4fEAhiAHY4SpMUzqej/QfrwvasjyqPnbD+vCqyTivNmpTb6LYzXP\n' + + 'BtXQW0A1B6EhmFwftGyNxIG1wEO+tWE4v4XLCyscAz8ZBMBPdfaRe26lnr6C\n' + + 'UnTUwL+VecX2uIVRE9w9FhXuKeaPoDzPWnu0SZ6WCUV3DxQwMoUB/3vJ8sRK\n' + + 'l2L+h0L32V6yjL0asut2G+qfvw==\n' + + '=o527\n' + + '-----END PGP PRIVATE KEY BLOCK-----\n', + pgpPublicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + + '\n' + + 'xsBNBGTvQKUBCACgsuLM540Bq39fAbLRGoaRZR5/lETkpQSArzP4+B+wxcQe\n' + + 'IItuLF9z1+OHilx/uAJ6yWH2En8QdlSBRMDCSwhLOXYnrB5dTvEM2nm+v59H\n' + + 'sIRkRUogXSIgTrcVG7Tt0JsrjBV2avOki1L4vzPvHEDUtlKcxdJ5914W2lSu\n' + + '05xPG+ALRsYFki1ga6bt6kT1+v7GV+862hOHY/FugohLKdIZOo6CeI0ddnHF\n' + + '9jL3pu4aTRn11VIphju3KQ2oCxF/6843OrA4X/GtVtsoRq00RBLuv61ZmRpr\n' + + 'qsOgEz009cDEWdUWs8wvf75TG/MfYM4g+9nSWflJGMSD3PfVHKTzOsYlABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO9ApQQLCQcICZD+BWKBkBMI0AMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBEXCtUQEMuKbuZLzrv4FYoGQEwjQAAC0VAf/VNnQ5xfPHhm6\n' + + 'JfZ+cH2lUfy65pZ+5GqXHanB9RcxZPHe9hzr0l1IJk4o48HUrIcwJhpBfXUs\n' + + 'd9oLC81Un1io0uX37hE3in+ND4j11ZiRe8kQakH67/R7XKUaD3JTfXTshVpW\n' + + 'hVTa1mjBZZcxOzr8ZxhnuaSQ7888t5cF0zBuOo6YPmqiNVudlXlhXuiAVqp+\n' + + 'xK5yamqxW9drz767aXUAvE9GChE4+P0ia1wwvvA2wkZTE2+rJKvAWA8iit4T\n' + + 'eOTTDJoja0zc2yKxytdeOy6PWr6lGjjbzJEq9uqs1tx8znRosDkb+Gw26CHd\n' + + 'Uo2uVUDGkcesqxNUv+C/4R9eubBVYM7ATQRk70ClAQgA38Hi0a1rqZAPdBaU\n' + + 'nlqY4x4pIi2KyFPQ7TmW3Y/V1NgEm9Y8w3bx3TF8O8uDETn6U5ASUa2DG4gp\n' + + 'pcZrDqFsChnxhHOdJhEgh3X8LeyzuCHnqWQPbo2iCt3ve0fRsK/f0ZPABgCq\n' + + 'lgTGkeVi7KppUqB1FtkRMfh0Eqr3fLC9pNRLtlnQT793rfavvXavK+0eeukZ\n' + + 'VPYbALuJq2tX0IBwr9+/6YEzSi7yo/1PpRZSRSM9KQwk/R2ohS2FAytUpTRp\n' + + '/4OFIJqv93PxS7MlHVfe/lhc9fXeTvH2sMQCfMsp16wP7Em+AjT5elJgXv3V\n' + + 'rQ4whrr5yGfTvO9uQVoV7LKoWQARAQABwsB2BBgBCAAqBYJk70ClCZD+BWKB\n' + + 'kBMI0AKbDBYhBEXCtUQEMuKbuZLzrv4FYoGQEwjQAABMkAf/UKvQHe+oYH/h\n' + + 'U0/p7OXUMCKIzSHD9c7lrb2nnP4CGyxF+FoZbQ9qnMVuT6FX6zPyZgDtOjp8\n' + + 'GrvcACBibxwujfnNdKBdA1r0XQGf2ht3BWYpgn9jGYw58bf3yaxr6/Dg1D7F\n' + + 'zgbNFkaarU8C4fEAhiAHY4SpMUzqej/QfrwvasjyqPnbD+vCqyTivNmpTb6L\n' + + 'YzXPBtXQW0A1B6EhmFwftGyNxIG1wEO+tWE4v4XLCyscAz8ZBMBPdfaRe26l\n' + + 'nr6CUnTUwL+VecX2uIVRE9w9FhXuKeaPoDzPWnu0SZ6WCUV3DxQwMoUB/3vJ\n' + + '8sRKl2L+h0L32V6yjL0asut2G+qfvw==\n' + + '=4XKH\n' + + '-----END PGP PUBLIC KEY BLOCK-----\n' +} ``` -| Param | Type | Remarks | -| ------------- | -------- | ------------------ | -| `combinedDID` | `string` | Combined Chat DIDs | - -</details> - ---- - -### **Reject Chat Request** - -```typescript -// Accept Chat Request -await userBob.chat.reject(aliceAddress); -``` +| Param | Type | Remarks | +| ------------------------ | ----------------------- | ------------------------------ | +| `decryptedPgpPrivateKey` | `string` | Push Profile's PGP Private key | +| `pgpPublicKey` | `string` | Push Profile's PGP Public key | +| `decryptedPassword` | `string` or `undefined` | Push Profile's Password | -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ----------------------------------------------------------------------------------- | -| `target` | `string` | - | Target ( For Group Chats target is chatId, for 1 To 1 chat target is Push Account ) | +</details> --- -### **Block Chat User** +### **Update Encryption** ```typescript -// Block chat user -const AliceBlocksBob = await userAlice.chat.block([bobAddress]); +// Update keys encryption +const aliceUpdateEncryption = await userAlice.encryption.update( + ENCRYPTION_VERSION.PGP_V3 +); ``` -| Param | Type | Default | Remarks | -| ------- | ---------- | ------- | -------------------- | -| `users` | `string[]` | - | Users to be blocked. | +| Param | Type | Default | Remarks | +| ------------------------ | --------------------------------------- | ------- | ----------------------------------------------------- | +| `updatedEncryptionType` | `ENCRYPTION_TYPE` | - | New Encryption Scheme to which keys are to be updated | +| `options` \* | `object` | - | Optional Configuration for updating encryption | +| `options.versionMeta` \* | `{ NFTPGP_V1 ?: { password : string} }` | - | New Password ( In case of NFT Profile ) | + +\* - Optional <details> @@ -4724,68 +4949,57 @@ const AliceBlocksBob = await userAlice.chat.block([bobAddress]); ```typescript { - did: 'eip155:0xdE3CA2cC2c91Cb9B3aDB80ac497662Dd9E57BFaA', - wallets: 'eip155:0xdE3CA2cC2c91Cb9B3aDB80ac497662Dd9E57BFaA', + did: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', + wallets: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + '\n' + - 'xsBNBGT29asBCADVtp8rHsmtqgUSHxutStJ8AO78jWFFerHJQQ7M/QRZ/1mg\n' + - 'uDTt4QTsmhNPlyzQ/OztVDOddn3qqZg4/gLUpJclMmR3UmxmTGrv9PaL9IOv\n' + - 'otdKrLlYKeXUHbaBWVgXHv6F7hrCx1Faiq4I5Ca8tdxhKyQc9WAA4f7TTxhg\n' + - 'htDY3VfRnp1LFlXyx8GyqCBGpmQx3tSK0w6SoC0FdCq/DpaXD6ofIKH8kcjJ\n' + - 'vpBXw6MLwymZrfzbUtYWykOZ7QWgDWF6Y0xjDjZvlajGeY7NfciQR+2ylb1r\n' + - 'eOn1yGN0Fvw6+7gGZy85XaDoCnyDAws0Nn+2G9BqTKVH0UwweWKcqOtbABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZPb1qwQLCQcICZDxpr16PpcWmAMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBDqZlQ8vQkW6qMko3/GmvXo+lxaYAAC9AwgAy6nLLykcdRlW\n' + - 'dPXUN/wTqowopbuRo5bMhz6+Q53Hf6qkjfknaswoBtE2bq/J54N0BN70Lv+j\n' + - '5klfjZWJF2stgMEyQfPbXp1yXQi9Rlmvg4qZvZRww5UNm6CuqxU/stXQK/Je\n' + - 'N9eIqd+fTB1EMKwbFrFHfOSKWK7OGnb6fi6JqofJcGvA0Oj1Wkf3i6UohsZL\n' + - 'XE8L1Ku2IXc4oUZH5UZD6vRYkQg6/EGq+WrHUXX2nifdK5b5tGZcfGe6Tudm\n' + - 'KeYFGTGfgbA8ag67nD4Esr296Mjjm06TTvqdo2r28/zn5KcRPWtHNpPU+t2u\n' + - 'kwq7UBvoroACgr3yZkdAFLt9E5NRTs7ATQRk9vWrAQgApfSeqUx3ob+kinzU\n' + - 'opKC8L9qV6jqkYu80coITufcc4TUEYlNEZwSaMRA+vOk+bwWbc+zJG7zW8aq\n' + - 'Tx0LyZqABgRsWOsNblepCzyejLmAwxl8kBEAMQvJ4Hjo55MGEjfsIFSqeEGt\n' + - 'PkPZBpxYN0/sB+yYZDt+59L0GGLC0vrxvj9aLw1xRaTNCNLkawTa8vTCwSTY\n' + - '/833aJy6kevAXzj7V8hOGnY5JU6dx5Wbsi1HmzuhtW/lG2n0JtYokfpESnQ7\n' + - 'La8I9PqpJC87iFEdt7MST2x687sf0vJI/QMRQ2kZF6Pi8LRYuMmrYTF2BIaH\n' + - 'kmPafAoy8BYNfetl67EArGHckQARAQABwsB2BBgBCAAqBYJk9vWrCZDxpr16\n' + - 'PpcWmAKbDBYhBDqZlQ8vQkW6qMko3/GmvXo+lxaYAABjFwf/epZQQVs6w3Fj\n' + - 'JV2OhS5PYsNr7hWAgAVTgqBLOuPkWG+yfwmayqyQKJmr3a/e+1wKC+Mrz1D7\n' + - 'cRpyiwyiCp01has6qMAledjGweg5wTz4axMSQn/KsLc7dsLOtccV05RkRPMZ\n' + - 'vRDDJkfIVYILBikTcg5WEIulGuy7enQO+Mo239WrUxi2QjAkEMt2pxjp4qNM\n' + - '9vMEPo8uUiEj/+Tsq15kbE5NGpL+n69R1/PYpHp6R7acimsZlXqyhUVaTD67\n' + - 'QDFLdR8nVToU2ACOvmJicTVHCiDbRfeUgMaaTu45degUEE7rbh+dNiJrkyFh\n' + - 'GCHIKjRcKEpModMxiZSJBINcWI2hlA==\n' + - '=ktHx\n' + + 'xsBNBGTu6YUBCACa7JaMqfhAnD/9ynE5Rhi8KNQ1tfdQe0ay/9jXX2naZIA+\n' + + '6WCi1uNcB2TTLfMuzsEl4u/26LTgtkr51snRt2QKgEqi5dXqbRD76wiRLd4h\n' + + 'ktBb4WB28o+BWOHYYJQq8he+zu3mQWjKLb1e9DyS0cTzwPwWVKce9IsG3NOi\n' + + 'eM7O5Kg5cU3qHXR+frF25peCBrzNXH+xuuTJPsX85h9dSz/u6dWXhk2LsX3s\n' + + 'cmX5mFcFErnGvUBddDGZc11q+WzZAtENPCxQrNjpkMtzCj9UMwgsJdzBghZZ\n' + + 'ZouGTG2uhfmIj3/KHOdwx/KGpTgC1iMVOb78kw9LmaxL6fGy4x9uvvI3ABEB\n' + + 'AAHNAMLAigQQAQgAPgWCZO7phQQLCQcICZABDloJB8hpcgMVCAoEFgACAQIZ\n' + + 'AQKbAwIeARYhBMga3B8GDU79nd/0mAEOWgkHyGlyAAAbHAf/bJMPIyvNZNjO\n' + + 'JK2xA1hYpzIGdbi3jMego6GXrmet3qY50zMKDccB2Ot399y/nmWMVEyfKYaP\n' + + '7N+mJbeAqIZ8TAHtpw++k/h8/hXoxb9iPsQyWYossuG499XyHnk+KEd4g0Wf\n' + + 'mqPk/XJB3xLLgW820jOsRRbWLyYKJEdh1Q+GIM+D6oIJ9ZmyRPv25u6yCF2P\n' + + '2IQZErWeYD/LxqMDw+uHdRZJRiyFy/Y7A43clejN+p3my8oktXh2N4+tEl7i\n' + + 'Hwxc5z9AOffuEyUerm0Rjwdn8rG8po7AfuXwmTiW1Sdc9TdJtAK/n6e9EFHV\n' + + 'gHzArwyaydHHy80Wqa+UF591NkPi387ATQRk7umFAQgAs0ao+EFoKJirGHfI\n' + + '69vZg+eAAUUKG657BzNzTAF2r5Y+a61jdcCAL+DXBcfks+H0dqG36zjOZTCJ\n' + + 'NirABp5RRPFty2VvUtOyezuKX/MBVg3st3t/yE3SncVaWMblAv3iegviNNpH\n' + + 'cFKqpHoVBWDNdhFHNsKTjpJcq3BVohy2Dxh8Di8N/1+gEPxADvIuH9MQ8MJk\n' + + '6lB9XYXBmmqtlQ3sB916mvusUIl8Zxw1C76yY0PAXz055zJMiL1vwo5gKDiV\n' + + 'iKyzry3wq7upPGJyeTKu7uUMifTPhJtyYvon2TIik5DIgHpqKziirCrolA+s\n' + + '7LhnFbawqDKleEdyCcL5mFCzXQARAQABwsB2BBgBCAAqBYJk7umFCZABDloJ\n' + + 'B8hpcgKbDBYhBMga3B8GDU79nd/0mAEOWgkHyGlyAABIqQgAmK9ijEEvtWTm\n' + + '7/mhkuDEtfPfcMexfkaCcGL4SdZqVz/h+eIL8+4EbI9uq+YTzcjtX8FAEQta\n' + + 'KWFACNEOPmSy6Sb9bDoNZUVpDaZzNNtqIK9Brt4zjJLEsDfmkuW3S/SgIYBQ\n' + + 'yTkuNmmAf8dr7L4fG0JlxPyGaL1/w9UDAr7xdU7WcHuyPc0edDGeE7NwaGWp\n' + + 'uBipXFw8AkikV3fCTDuOi3uhkIzZ5zlGCshD7m0aDSABwr4hbFzLFBDSrsiW\n' + + 'GKhWGYgf5Vx8qzlwXYYnoW/rn3UXWpeTXjq46ZNaxjHJ4VxGMyn/tHZOEjDE\n' + + 'vHapLIAgGyw2b+s+zZSqsXaMkH8WOw==\n' + + '=gPzx\n' + '-----END PGP PUBLIC KEY BLOCK-----\n', - encryptedPrivateKey: '{"ciphertext":"5d3b651b63db81767bd7b9387a085c0134a30d2c77545b4db528c15c429286620edf527b069d4f90fb7e7e769c6a0fff19f52676972765881cbb601e78f386cc492b6ff7a4739996148904dc09f4f95ebbd53ee4e0f17d17dac66aa5b11e09daecf307b120f5d1157465ef15114b0b20642d7b64d45a218307764bf48c819e05247db0d782745d458e5ca574f92e0479188d5ba557201d58d85753f2619fd1648a80f8153e4847b7fa455e50379b096b4e430fb49b3084441a08f715f3b99c722e5a6b730ca8c2160075594caf3fccc26bc9289c116751e4e8306cf33b96a60bbbe46bf4363dd3b25529ced93c67ec60a153331fb340d2344851ace937dc161dd9aeef20dc71a6afd7cf308d8f4c05e9c779bf5d684fbc4620b955b0aaa80f89287c197f2f4b00b5450b55770ca1d44c8a78583762c3740dc88fe122afbec422e64842ae9719d21334d0289718468d11a3cd12373583488da7631f924c9f1566c6eaabcfc9f146fa50e49986300f7e7a3d36d0056c381f6decb38b10ca291a747deb0d896168fee9279b5bbd0ffb7aa419843d1f69da632552aa885ad694fe8ab50fe0bbc79ca4980e522d4b001215bd267752340f02270d05a5ad8673ef998199b1b0e6930cc53c97a14245ea5355e10a438513a94bdcab49b4aa605277ad11ba0603ac59d6f2e1068791a61b4531d55c55837bf43299524e5c4ff454631eddcdab0f036b70985e49f155bed3bbbc36f9e69b6c411077051c2f3083354160146336f7d023b51b8091b32cec3b0d8e5dd67f3796e00472d1b305ad3f861b6ea863deeabad29bac8dad1ded1a59fdd965ff5903c7dfa1ad956a4264e2227ffe9bd9e15ce7eb48c0a6494c07a95865770adacc94703c19f4c1aba9bf885d6311490a285d42a6e8899de07709e176a30dff3e8988de3f22188d0adf03bb633607ffd4daa503b7121a5e5c3946bf3a48d62d511cf5518ad94b43839827af07faf9037bc959a7ef621df75ad965045dba6c89ae255d200ebcfaa0a2f652ffe630df57685eb471c4b089ec6e7d4c841f1e2e25bfc3b852cf79c4fdf66327a18302fdc10c6f044e42387bb89c45644643546e93324b8ef4d7ddb6016457f5098da369915ac6e1d2ef45fc9155cf13d165d7822bc6e463932cc69ac7b372a0e3b18c45b45bd275b38af4b29d665856dfbd6e6c6ecd9b6d02f4e61308273d76ba0baa0eaa03ad831adb428ec70a1dd29b3b2c4941adfddaa76ac99c47bf6eef92a361ab890c3e9bc714263a4f93289cad7344882886aa101685586a54e5da7d370449b91400e48c6a1ae8f6e2bcc06fe186d981399c28143a3faf1cf2c06342b82382c01096ff8542ef55c24175d052f199fe39a4ebf39c56bd30a8251c19745d1b9d0a1a96d81e6cff3c060d00d85d627a9344e1ae98cb42c1f05cd2dd9ae3d83b7974a7bf96980c33fcd76f96ec6c2ea11a2348026333424307f1568e5aa575c31f819260d52ad968e9a17cc46723ba1e129614d2a47ece4dde0e0cf4bce2be7ab25441255997d8bc659a194665090baf6e071dd4775b2e2f7974d26e0cd040df9890ab58c77732d6e33a8ce909e965c2f04a7f65ab5331c044cbbbe39184721310235a772b30a30071a8058b9941f42d85c2e63bbfece7d6116a507bf1612194ed17f430274e4053d2b8de761cd6c316f08c401c66f1650d0e83fcd0d69dc92763f8202748d8e40bacae6cfa264d8ab19ff86e1753d3a33c3ee9b4b9fa6ef64765e9d2b2ba52b28e61743aca96471e6c35143ac8238275b504e7d0ccf0c9cec095d02259849b5f382fd7eb0b7fa3ddc0c5dd91cc2be7829948852dc740d9227f17b2f960141f4807678a2dca6ee24a858a6f20874b1b8e35305106c77c38dbbe52d3e533a845dc8a0912c7d95218c6b820384de5c2693447529522df552383e35d126122801008aca30065c8f93c8556ceb09f5512e64dd481d5ae823675c201124759a80477b1be6ff4756e94e814b279f4de19b79a72acc52d0e1d1e9119abbcbaa1ef0c6dd50894db4ee5f4c005658416fa840f19e36b65c591e73ac8ae4d9e49ac13dfc40d754cc4f9eefd327876a94e5a72f6ebcc8bb4645f6da8a7505d64190ef400829be6455737fb60d595ab13cc9d8634514675803693402570ff869858943c4cfaf914402153a41bcbf417be30c8220ff994d48d85a2893991a5241d407e6acf8341d11bc72de3967720238b218052580d121c6d2d01e788d6cfb2bac26ae205e0e72198c40418bb6e3f25f0e14f03d237bde9efdccdcdb2659a40276ac760a4eeb0770bdff49513b88e51a649bccd82da5c82e6c50a91cf9145091f08bacf7aee46e80bdaeb320af371d6e6b6bc29fab41df2c4f09953c0efa3b92f0745c9480536680d60fa0badaaed85b8836b5e5e54c5aebfc99e2a3b32ad3a5c882829b55e9d80a33468b05e8196c408a9de4a13af00df4c9b632eb4d04372c99c8020fad56383cd4937088d2fb4e7a0c4edc15e3bd79214337e02fc72cfa703e12bebc396068da9eb6ef142a55f6eefd8d11a501c4c6610c808a75923e2b279a2809ca34c2da49731ce85756a7039b667cafcb081693375f4cf8e1b39aa5f29560d7ca003775ad5affc621c359198a4dfe484edb11853586c1c664459c996457454803fee7350786410b8b9d81bc0e31f4426760ef812ebb49b1a63612c3c3249a0dfea9b50b620a818654bc18bb3f411024ef9ef7fa21a494f359473bcb30c70070b78ea9106d5441dd89322ee2a31c945b884ee9008841ca8dc776aaa6c46526e6a21ead1831b20697b75905a13dd947ee53e6a105f0bccb3184f679b05c475f5294d96a16fc50dd9430967a1c7013c054f3fb0fe07c586c5835b048238fd1effb7bcb6ae6da40883f387dcf684ac20709c59a312507d125fbb65208a985f0a6f5e2e442330ce39c0503d27cd32d61541f99e1d20b2314e830f3d03918be89152a0547a45ba0a419ef6beccb83b444c8081fd12c79f8d88ace21c9057265b351a7ed8588560a9f549149b1e2fcacf99fa6cd045462122a4f60d969fdc7d780465349fa359c95a5b58a9e2b751e45301696407a1ddd17c32dc7bd5acc3ce09ff5ad20b9d91a9ac8eb3d142bb6907f19b789cbbe15a2a34469e90a652e5504228f12411a4ef54abc1c1d9a132ab85e42f1dbe2c14eab46532f22fbad0e912911f44510c10569a99a0a99f774070178776a970d83bdf50257cb6ba08ba6561b16535b1e05c16a06bf0e3b29b082f66b8336e676cb4c6e9bf98362b631173f683d251c4866e49860fb83f4053087f44c033198397ffb69b7053746ba150e16399c2f064967334f893125de76539730211f8c6edff3108db2c7e8641fc50ccb9946596b59fa425265ec86db50414218b494b5166399209a1d664d2157da0161d9786396dcf2d91f9433d39219d35f6974c96e4f1bf5f5e0a17db196e97dfff13e58131ffcbe3a8a647cb6a17754657b93e9b9cb458b9bd1d8cbbde72cdbccef7073ab2c290e237423b8053a5cbf358a88d1101e1f648c392c80704c7dc9d0509e186a11a9d90e9106bb1fee1883af0daeed804702b9e2384ab0c519129ae330914ade6c5080f6a2d17b716f71d81c352c07c2cca0c210e0d951b0fefecbb00ff0c3693fe262cf9125094b46329eed041d3801025ebb67722659b98d3e5da83ba5343a058540e868742ac36c852f26b3310bd33af4884d3e51e046c0ee17b714ce1f29df6442468791a469eb1e387cf9d366d24b00aec6a089a88c96a82a1ff71b1947a24015b1cc13be259be5bb75731a18ca58aa46609e2a2ee9fe0583588f0c453a2b99166831669547428941bda9a65ab82462de8add40f16976a13e36a0018886d27b4cba663369d13fb056a874f6d5e0e9ee6567ce7428d9e179790b44649a05aa8523fbda4b9db72873e9aba33892bc0677339332d5da9b3b4754e2b387597d8405de304d8b65ba6bba9b0558457431820582df5ae3577efba787ea3b4eea2515cfba590c7821d2d47ada99c612ed4e3b9d3ff9ced63e76379789da562f45f851bd10e8e6d2ef633984ef4bc6bfdb4c833175448c3c6f1f7735587b6e325866a21b8d02cda06e9520d18350e38b428b3949635dad18cccd4d840d9e4c872b32c527d2f521de3822565b7af6f5d8e254bc142029faa91effaaea2ce70de748eae946a2521d3b5952d5874e5bd6c4322a35660b51ff114d5cf6c5b5fbaacf834eb1eb68087ec06668dbe804d349b1d5bd3396099f3062982fdb9a6afe542c8529752c728501ddbed65a210a28f351f3f44ad40d3a6ce4995f2e6da7495dfa40a4838fd2d808b2e298a863a7475c2134a713cfe8a47fb5bd479891c2747f0db0005ee4a894b6e8b66cb5e1af8d938fb1f5f53c24aeacbcf25b57b83c5abc3a1adbf7853e0a6ed5904e19d5d824b1500296550589c4a3186359b72a1d482b02dfdc1874e64c78a9df7097696457832d6aa572102000c06af444c8ab83e6204ea920a2a847cb163efd9a4701148b4009b2f8053bd7d6408045f627df3f45b002d249a20dd829cc8ba18d9c468d816d451b7f3792e31f360c5932656aa7bfae55b75ae0c40af53ad33005d065d047926543d68e9548c51c3d5405a164b902825fa5ba8c8be5dbfe8632a94df6ae322425be86df9234140bbeeb707d45dfb4b64a09925499ddd2192ad1174776f006f3e91627768f60be59756b7a9b51e4e4e02c01a7fb8b06e63dc3e71951e0b426652b1796bf546da832ae70b055a4700b3d6e266f4af898f0f517277db75aac827d6c30f75c6a6fc9fe6ef67e6f3fbf9c21f731f1f5d89feeb1a76c7ac9923320eb56c517f937a32f3629a8fb4f134a499562f837515596508cf6b2ff3de5c536dedf2946b85505c5843d09bed34","salt":"7b0c5813b930a5ab6713f1572441734633ec845aaebf526f1daafbf89ef268c4","nonce":"bf2c1e6312caa6a32e95eee5","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"fe71bd49335560367aee6772233e69316de48378df6ed104647068e8525d2c4e"}', - verificationProof: 'eip191v2:0xe58171978843f55fda11f3989ef8a2310a3366585cf3ba6c71dc260e362bea1b2b2667e287959f6f79628a03073d5757011b7161a2782c32290f924486f87e0a1b', - msgSent: 1, + encryptedPrivateKey: '{"ciphertext":"4f1243e1ffa76180f46ade2eb093867750c6bf72e8d6c71c7c0edca176c2f9fb32c603bb5e52d933730e0350292431b6e5287b8201f60ce9151b6a141bde98cdc3d9e5df8f84e00e5e4173bdf28b66e9590db10195fbd41ed241a65ab84fb5da251f613376bf78efe1af64613dd54fb05dced7cf8de0907d61489712ad42f06b5c775d97d15dee09b1c58cd79f596674e403353bc7e03297aa0d3fdaecac573c962409622ff8b1335b6fbb661bd2d5f5a076d9079f857849ba917662b40151041eca71385844160fc603c4d1beefbf71b26ac8968de52d6bb534ef6d6e2ea987170059d7d881dc684d28b5b2817804fba3b659e3ec0e802583e581b9f75d2f7e69e428cba91e62719e9ca6697588389db89b982370d23952120c0f972ab4b3a0da888d52b5055c60785d276152e43929df532bc7d5d68c6bc3cfdd1ca780df346113999a19d8e4a96c02f149d1ee4cde802277081ef339153872c00c9e9ddfe3ba8da8c68c0565752fea32258087e66aab37397a27b0228b5ed1aeb09a93b80778fd7f949409106c4cd82ff550aafb9d7bdce8727a76882f59ef2c54a137e51f04b6c27a0b1b92cd781dafb489a5e8203232669f5416454cc9cfe8c5b0fd8abc19d9ef16285a8da0aca2ed747adef7b49b8215790266d9c4791c250b0580e89c6429d10a1bcd45cf016a7ae30e1db948147d992722a7191e31852e6fd3c3679d868f34ebbe65f255be4b90dd64ceb52eaeee7d3356683b7fd511729493c887289ddb0f00c65ca2a95114f0e37d3b73d06333e2787c5fa6dd6f6c9e8334ff153dd63e30c81247efd497cf2c038843d8653edf23822eae07dd19d0be26a921673185bcf016533fdb59150ff46096419e6a6aeb1bd4293fc8146848d715d43afd04aa40f2b5ae9d058671677aad2413952a20b5214e18bbf3b4b033d936d673a0302967de3f74b05b74bc6c89f30ddeaab1bf6c567fcee355797b6cba17c3fcc8955bdf096e2dda2577b3374089d8c9d287552e5658c91e812bd0b8b63482c8de98fde216dd557eb34bafca2f8e73dc4582fa36332e8869f2717519921605915d8e1c75a37295e198ec0af75926d89a6832456304474a10c567334998226d9b6f709ebc216fb067d958e78a622040c91f46af202273d0b40307fb34cba5a6a57fbb196ac6e88c16d527b9bdb04b12fa7ed0bc771692712ccd146c41890b5caddbbb13b8ba77e632b2d7597256fb576ce87d2aff35a0e953b8227a5dcbf30f7d189ca7f77f6f8b2c4eb2752199a7a485ab52a6b65b6edd6cf65caaeb6f65544cc74c2fb3431fa484fb69adbda08d2402da953f20425832b6a2d712d56a5cc34095f25fb9524a478a71d387b7dea45b4bd41e79c61dceca332898dfeecf83999ed4fad892e2ede714b93f3969ad140f38bfa95d321ae5ef089cf0ce435d59f8b6611c0fd014c67ed38646f0771f1a74c1f950ee0900d883aca3ec4efbb2f7737e717007ae757d874573d4d70c9d7e38f8ff30a29b983036e684c4eaf35a7c03ed32a8e3fc62f0863c56830127a5f3c0e905a93e7466a4f43f0793cb6752b9be8d03d7be26170f694ecbb200f611bbf1dac4b6ec085deb8c3d8ee188d8c9c8c17ca720c0f0dee4d00e5866b5443b6af6e69ca64b8eb5a8f5fa1e1d27bfacbf1b0ae11241215358f5045b0d1a73d1b15dbd904709340c1e2b42a4ef78f76b8f901d6337849cff1052f06a8919255b596fb36d2fdf789fdf611813d20729c26d517dde6f11a3f6045ec5158652e128cf7c483a0fb8ab772cb5cdb56e42e6bf8c863f173307c3e053168e54e9e65bcacbb144413ff76d08a94929e6cdde2c5944246a4b344f3ca0ada3b403429750bdce76f04668b05ed79e9119f00901e7f7b4f1eea8a1b5b0186e3ed41277040a257601b0f3917db595f3f1808d92071a4e9521a251e9c5a66f2c8a57511f61b9fd88df77330aeb4bc15c043814b33610d60f6d0a13fd7977efaa1843913f6d3a79bc88020406c9979163684efe7b7ade9613221d06b52cd96abd31b77a707748d52e6e16c8c90821f29359b35307c10dafce5f35c0ff9802c23aef19f0a95b49a317cd6207002a5a9b822b4c056c4cbf9b27045dda8325d93060f358bb837f00954a6e281d1bdd1817a7cce8ed4a801f9164d32c52739c1ac650109868664be1fabab47c675222dc9ff9d75f9fb49531c832264aa5b55998675975f59e34829ce90b00092bd77e46328a6459d5c967d905b8e976611b839925ad742500231fa86cb5f7e6f39cb1e2e36b81c55269ea0f5fdcba5c8c0e38a899540d52be49c83efae5243998b926f029dc2980d4fdb1c125db409d015e0b36bc02272da1c688ee1f61d23cbde585064ab1e2164d0ca529774ec7797407ba5d988c58853e74a124a64dc24d0289b6a599354faf64790177c3032f5d660d7b76dfbf1c03388a7c75b2309c509c6a92144e124c8bd188274bc844e8f0aa7b5a06e79ad5776b5a62003b89aef194dcc03cd3c1b1f3ea541805cfc4e18aa159f9b5395185b573538c9bab16876dff91f365d16dcc56b339b01b86882ef8e52c51edd9c5b2f8a35713ed6eb43036e09f64f6e59ab417958faff974b6705400b341439fef4cba371c601927da7e0a8f23e1c6d3e070a19c2216da85f159d60303ab1321e479f4c371372845cef03daa7d2776c18face6cfa2ff9eed26f9f0a353a0f1c9a99b2556dccc1212fcb5c2078a3b0e58a7f3f7b3f346d624435ef94c95d40dc726d2e7400ae405e89473a934e7646124e34473dfe17f7f9cf481aa059ef422508ffe67f9b9276084973db0683269a046c1a0aafa7ab075b28008cbfb862b7e30c8b2afa1c2923d914b3d2469266e8e0182274a3d8d89642723820e61aa2d97a9370789ec4e89ebee05b6c0bef10778caf2a34c2d7622dde5fa64b012bea6205127c3c845229ef553f013b73823dc6631078fc628532e3e518bdc790ab8460078dedf0c5cb00492136813e2b91679bba82f3cf95169751933bee4358f84154014dbcc1de1a30613218039ebb2444429380fd283d3b60bd5d5b470e861f6ecc751c22aa467168512a0ef45755e6b59a7be591bd3b08fde874b166ccfbbedba10a0956d2d18cbda515341c2112d6094a746e9f562db6543e5bde2c4d4f7c06b7550400d66f7242a14f34cd8a7374372f0eea49a49b72909fc11ff81ea54a1e2c07225cdee856383a657b0f13c14b00ae3b7b2a32a22beaab8cfd18641dbfa82619fdcdddd3339e9423e71c487305e8aa932b694e94c37c7e418e4014c8bb264f47e8283e216eeeabf0fbdd2f5eb8d0ea979738d4f18b7bf72d7711f5d22653f217c7305314ec2c47a0ecbf1dc8f9bc1379ae38e2a04e736a1171b947609bb66f8d352ce57230d709f196953471c5504c7f9f40ed2f64bf3bd04bd57521a364ea03b5f0603cceec7851738d97c3fd73c16547d4d143b009a79832a1ed244937dce09edf2d5e32ae52ab0331c449325dce9e5e8ed1563c967a5f92031f4275e3179274ef3e0752ac01caf8a20aabb23d584d4d6607833f95cfc92832d936c37bb8b37222aa842f48944d06b37434c8dce5f19b450a7d1bd568672ef2c8eaa2afb7cff404b33377a61061f56b01849feb918521a7d63cfbe12466aedc7159c577f213f2c157586b8719164cd7108edfa9211287b43aadbad997bc62f8169eec4a6e02aeb535f670878e6af538b5281da04470d318f893102613977390a434e0557302a68ce42e532d350446d4d813b84c07b42bf22fbe4889096ec6303574c95040d8dcfed1b9bd26782c5033d7d1a491fece156cbc19a705204ed38a547e00a09b73bc7a702ef9c2e659171d1daab63958268148aba59766bc7a4ffb68c1ae047d1f0c5fb45fbacd07079f72af301c6aa00eebc0662c6792fc707d388b339d4f45afbf576bacf8730ec3e0f1e9dc0f9a6d58fd146b2293aed8d110da24336f9a4c01ae12c03ce214c6502f5fbc5224dd8b8b2e4edf2af16b811e5c8595fa76cafe34ba66199caaed48b5dfd5ae74a3e6b6d51a09c70afc30ebc0f40d51a15f1a8c2c41ec482eddf14bed3fd11a9e2aa4446268af25b49e429e2528d5df57797f6f3cd431eb5ded8f830c85cecde8012c31500ce9363903739a6759704fa87bfef984ed0285c8c0a5bf2f0985b1b511eb4145e4b27e2df6aa7b5c7a913b76b1ca869151b75c0717389b3d186f4e4637a5ceba3cef64809c3a06551a6a46be31af61c0ef78afb057f6cc625647dc04dcd74eb97f7aee0f5640e24b7662c799013efb83c80ec2851acda7c6328de789ae99ce296494225bd169e49c9a12dc7e281778f7fe275e72571cd5a3608733998d2f6b96c1d26c25223153fc5afc2f6e3d72f57fbcb2d087d718d3b6703b286f1e340c23cd3bc715797edf3ce6d5169bcf783ac9686233cc0358725143008b25bfbd329e1c30654e4b4c9461239d41ae77f706e64e5e60ce6de83becfd056f2678f17474ab9f4976b2d7d5d014d78f716d7d4edbf6ce4ed44ed677274d6b9b6e4bf4946dfd1ed8b821c81957b4bf5cd534ed6ca84dadd9d6380513dc6406b32dcd5c1bfa468a79e88a56656e71aed0c6675540e1617a31e1c122295427590e83b63e8da58a6c5c21a15703994bdc2b90d399b62679a4269224257f3ead5a2dd0980e6f5a45c5a9392929cc4743e106c7335136c9f8a3a29190462eef908eab02cda97dbcb71dff26b0ef4dae51de293b4cff0ebf37fce1391247c5ccf77dfb64974c4a1e6beeaf82041bb0d653e2e9b612f3442bba8480b86fd7b35514fc056d7429d5fb36199d4a6f632ea615d9acc961082d9d91aca416b57582bcd2f182f5f5be02b3f597c680b2e6b37ee4d133e51d077491cb536d6261808c42684d0912fd7bcc97dacdf32394e7b","salt":"da23dc7dbf23136dabc337a0caa170c0db7e4efec5f5c8a648dff9b7cd7df49f","nonce":"fe0e4ec3d40fb7de21a354bf","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"b43efae4c92a35d9c0b5f6178cb8b8a6642c77d0a9281f61beb9f6e8f7b006a5"}', + verificationProof: 'eip191v2:0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', + msgSent: 0, maxMsgPersisted: 1000, profile: { - name: 'Bob The Builder', + name: null, desc: null, - picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA40lEQVR4AcXBsU1DUQxA0RvrK3JJReE50jADEpTZwRUbsEIq75AS5sgcnsFKE1orxUMRSD5n9/n8cqMxV7qMojNXVjKKzlzpMopOGCYME4Zt3Mko/lNGsSIME4YJwzZ+Ya48wlzpMooVYZgwTBi2ccdcWckoVsyVzlzpMopOGCYME4Zt5spKRtGZKysZRWeudOZKJwwThgnDtoyiM1c6c+UR5spKRtEJw4RhwrDNXOkyiu5yPdK9fXyx8n16pzvsz3TmSicME4YJw3avT6cbzWF/pjNX/iKj6C7XI50wTBgmDPsBSK85Mi5fmXwAAAAASUVORK5CYII=', - blockedUsersList: [ 'eip155:0x30d45C4aAfDB894Dc529aE15e7A55fCf49184eCf' ], - verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk9vWtCZDxpr16PpcWmBYhBDqZlQ8vQkW6qMko3/GmvXo+\n' + - 'lxaYAAADJggAoSO2WXXxPtkFBMcM2Bqc9pzBFkklicmWj3Fjl+6FB3sDXt3V\n' + - 'YGNDqSruqpqoiCpMATy9QC48zO9Bj/gbIzuIbLRvNs9M3D5e0si4/OHKIbSX\n' + - '3dBiaqaLdki7tUvtPioQ4Q1ZkdOATr3Wr/PyrHc0V00fE64qb0MlN4ouvYYf\n' + - 'yG4WK/0x0iH/RPRyG60fkrsmZa/PPpRBzReZXwrsVbBoOCBSe6f9s3EYTfim\n' + - '4ThX4zrbwKXx7Wgv1lXw386jvlaqUze9A14DAq6OjwqAZEVmLZaq6r/OHmqM\n' + - 'Jy4fZI2auG9uYDorCxP7n6RjOSEOCLG8k+WRDFn6LSPJpdrYoYi6MA==\n' + - '=d+/X\n' + - '-----END PGP SIGNATURE-----\n' + picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', + profileVerificationProof: null }, origin: null, - name: 'Bob The Builder', + name: null, about: null, - profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA40lEQVR4AcXBsU1DUQxA0RvrK3JJReE50jADEpTZwRUbsEIq75AS5sgcnsFKE1orxUMRSD5n9/n8cqMxV7qMojNXVjKKzlzpMopOGCYME4Zt3Mko/lNGsSIME4YJwzZ+Ya48wlzpMooVYZgwTBi2ccdcWckoVsyVzlzpMopOGCYME4Zt5spKRtGZKysZRWeudOZKJwwThgnDtoyiM1c6c+UR5spKRtEJw4RhwrDNXOkyiu5yPdK9fXyx8n16pzvsz3TmSicME4YJw3avT6cbzWF/pjNX/iKj6C7XI50wTBgmDPsBSK85Mi5fmXwAAAAASUVORK5CYII=', - numMsg: 1, + profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', + numMsg: 0, allowedNumMsg: 1000, encryptionType: 'eip191-aes256-gcm-hkdf-sha256', - signature: '0xe58171978843f55fda11f3989ef8a2310a3366585cf3ba6c71dc260e362bea1b2b2667e287959f6f79628a03073d5757011b7161a2782c32290f924486f87e0a1b', + signature: '0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', sigType: 'eip191v2', encryptedPassword: null, nftOwner: null, @@ -4822,1642 +5036,1798 @@ const AliceBlocksBob = await userAlice.chat.block([bobAddress]); --- -### **Unblock Chat User** +### **Stream Chat Events** -```typescript -// Unblock chat user -const AliceUnblocksBob = await userAlice.chat.unblock([bobAddress]); +```tsx + // recevive stream related to chat + userAlice.stream.on(STREAM.CHAT, (data: any) => { + console.log(data) + }) ``` -| Param | Type | Default | Remarks | -| ------- | ---------- | ------- | ---------------------- | -| `users` | `string[]` | - | Users to be unblocked. | +<details> + <summary><b>Expected response (Chat Request Stream)</b></summary> + + ```tsx + { + "event": "chat.request", + "origin": "other", + "timestamp": "1696576961629", + "chatId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa", + "from": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "to": [ + "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899" + ], + "message": { + "type": "Text", + "content": "Hey There!!!" + }, + "meta": { + "group": false + }, + "reference": "bafyreid7b7m5ub3ouybgp2nzu733vle73bem5jcz5lg5u2epknncfhfeuy", + "raw": { + "fromCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "toCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "fromDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "toDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "encType": "pgp", + "encryptedSecret": "-----BEGIN PGP MESSAGE-----\n\nwcBMAyaG8qwtJd4vAQf+JbzXYRQZ4Tm+8P+igfgH5kHFxMdd6XD11+UgyX3o\nhvxIaH43AjtpAuhNCvVVnmmIjWHAnCye7IDrT5BFEYVI03FaxxMyAwxvROTe\nb1xn4R5TmXPzuZ2N0AGbD1iTAqvPjLj3UvHJJihilOOAs5rqUNmWns4+xWr6\n8Znl5J2RyyqxJ3+LnHn4N6Spwm1gFzJ0alS2gwp+Tdi7OEPRiiWTkIcrdRcw\nKUv1i3aJw4Jyd9wDz6jldNBsa3L8RHUf47Oo4b/17dEqeFkioKCuWyH/DlKO\nkxZRsZEGUDR8ILKCRxbQw7RwWjxQnUeP+4oRuGC6P34zxZEJofHFz/8VWjlG\necHATAOhR72eaWLr8wEIAJEP2F/ocesJWKafpUzIN33fTTIFBjIvVB5GXb/V\nRvtwgRqsrKoudQLUf3ybsH2jw5JOmA8nV4Kc/aB/DVtvSyfObLxxngXe4HnD\n4OlUBGH80Z/RC2p6egrxIQUu1AMhTpu9SJ3HApTHHkDtGetp9Lnax5AxEV2t\ntFQWgkfwYy0xz2UuU+f85skTDgHBn7cW4Hb8WAaXWptpoGIlxMaVQYcHzA8A\ny7opcoPJPlE7AtRVQDmrQDLMZTRjxPwu9+vOYSh9bC3QFXE8PQeaseK379BG\no8wL6lnfX9mOdX3xaXRBuccm5akT61UGHnFH1zZv+rhyM67/bVCsIHEsG2Mt\nSHrSQAG/I7P/KleW2A4iEKPW8LAV1hGFkZZj1YumMGqHocTLncC8QwKzzHzi\nKyO4PxEL0qhgP16ya+vzT0PazgQnYtA=\n=AmIG\n-----END PGP MESSAGE-----\n", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AACmjgf/XGx0k/OMCg7XNIb5DjPMtiDuSU9Gm5KSUGhoBDIatNhrgZsj\nhULiKdk0DG1tk6G6a1/IpxM17obw4q3OI6QrT5TdgNS5c4kNRJ65xN0smxLl\nZC9fM5GEoTNI9CMIghH+zTesmVxkq6cS5iwzFJNgV05MoCa+HBCSHR3oLKFU\nH2muI7veUj1/yF93OEqtsqUjsgVr+bsqSVhwD8hcjS4AlRmHgBCLdwMWSOnK\nqFFV/0X/SZXnq0Jy2NULGFGTuQSV6NhB448HMEToxGrVbkYhPxRazBbEaSxD\nDrYQ+8b6EQBSJlPCKO3MAV8CNMNbfwwGo1RtXm6+xZj3DCHEdiU96w==\n=BRdW\n-----END PGP SIGNATURE-----\n", + "sigType": "pgpv2", + "verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AAClEggAxIFP9BJNwHzqUlEB8UD7gK+wNJxx5Nc7b31y0edUiSL6MWGL\n/b82efqACFNi2yc8/3xreJZr5ZuyHHSuCAb6zRamBS4QYTD+cMhNwpUTPiQE\ngyGZejVP8o+ko4N//itioi43BC619iSs7OTCvXkWS+gLFvOeRrBBPfp/15NG\nbeTavruBfiIUBR3YGtlcY296LLmo2YCEz49B1q/nQ+Ant1UNdhmuVhqU6W5l\nBzV3mLkxnlxpey9JNnNjC6tiKDB34OI06aYc863mLphk0R3obzGyt3XQqgL2\noteUPdkfPsJb3DCdq9F/XRNNJtypnAWeuMk8T5OK44FfLnjo26lwHQ==\n=QPQd\n-----END PGP SIGNATURE-----\n", + "previousReference": null + } +} +``` + +</details> + + +--- <details> + <summary><b>Expected response (Chat Request Stream)</b></summary> - <summary><b>Expected response</b></summary> + ```tsx -```typescript { - did: 'eip155:0xd1790E37fe3459e3F48eEEe41a7708a3eC2148f7', - wallets: 'eip155:0xd1790E37fe3459e3F48eEEe41a7708a3eC2148f7', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGT291gBCADFq+sw1v0dNAqkG7bMUZy0tzo3E6iPZQ5UwlOvtzaen2md\n' + - 'OHOTnvaCFRjRQZjrvlmbWwBELOTsHbmluA41MeayoJ7aA+o6+aflaa6PCUG5\n' + - 'ugAfXjuQxPn+gK0hFdn6IYxvBQHdh+Hu0Obi4peol1GobzraVZt/fRrXdttA\n' + - 'tLM7EmvX/l5440xO8+kZ9/uhMx5MR6fdD32AWPpGDy6tJin4awSdTN4eIwI4\n' + - 'ueKUZ0+B4wWAiEkRwIRWY4vbCCfMeF+qNMGBaz69I+YS/2FvyqAXTkyKytt4\n' + - 'U9efp+ObJsNGk8OA2JWZE+X/16eO8xvQSHhcoH5L2ahGTmG8+xr8bFoRABEB\n' + - 'AAHNAMLAiQQQAQgAPgWCZPb3WAQLCQcICZDzsIc63rzcLQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBLvWJU1IWhvs+frC7POwhzrevNwtAAD9Awf2KFgMZaNyYeMO\n' + - 'DNojkd6YpwtXGp4zxxL4JrZwDBginbcba4oUyTAqIcJWe3BAGPXX4hi3AYjE\n' + - 'BIERstIeb/YkcTyRgyZKDj7tDNPF0itxfiUXAETN7Z+ySkLWx+5rQ8B9VQv5\n' + - '0PLDDwBfwju2pp1/j8XTx/81PSjVKpFQoEsEPOj+WloOdonzx+SGcr5mjjYj\n' + - 'rR9NpHVUxi3Xx40zJVVqWFbTdnqd1Wm5SGkrRWLJAe1hzHhYxtpEDGqPfxYo\n' + - 'bBMe7bphBkh4DYWuemj/2PiZaS8NC1ed32YOwOSWJV+9wmUvIvq3Q08AE2yF\n' + - 'tfeNnX6Gb6fDgvPa3Y1Qg/0S3wYvzsBNBGT291gBCACqFMmyuJkBkNwwpNE1\n' + - 'L1bJLulRqEm/tCZ2HY58G9NGYgo6u9Ii8H+ia42bf9Ezq4fLBDzYH0T6Pe9Z\n' + - 'zAQHudpId8SNfT15QdqYvHjovxk7jqucF/+W7+DilPXZn6eomrOKePCNP8Cg\n' + - 'JXSoShkVaWkbkr2UkHGpcU7YIvooAtsxXMWWr1Z3hbk7tCf1uwXV4NlAGIXx\n' + - '7FSvWuQ5ow21GqM/6HyeOzbJRis0DNV5NHY6uUoFNUNzPPBBYx8DRDzjmmde\n' + - 'KpjialSW5QK7g8KlWaSGnHFCd6eS7pHZURl1l299ONNJ5m/B9yibBKwHCQ3r\n' + - 'V/8ByDlxzjU3wbgdZ7+LfjitABEBAAHCwHYEGAEIACoFgmT291gJkPOwhzre\n' + - 'vNwtApsMFiEEu9YlTUhaG+z5+sLs87CHOt683C0AAGnNCACtFS+hJSnqZDmf\n' + - 'XGSIw3FLkD7OsaOd/75BZ+cqXnfE4is4JlN7IceOHb/9+UlghAOfpjJYfn3Z\n' + - 'HobaRnUZTm8unx0uVQZ4PEZgPGuIKjnwmU75xZVpYegXTE55faiDoQZp0Kir\n' + - 'zyScqaIuxHGkuW5Ii4hcLXKBK5qKv8cydeOgZU4NJ7jb8DMQhWulx4PHOaMk\n' + - 'JR/sRVuzkxfZQ6LPtnWoTmJLr4wJ4WD/nM77W7XmO8ZGoe2hE5V/OZJC+0uQ\n' + - 'OPK4S3YmXcBZoz8L6/gdUQz6kaLtRzsP7vZfyn4jWhlbfad1R7KM1srRT+OT\n' + - 'HDPpdh1b+4npYo8iTcJTnANQ5oAm\n' + - '=rs9R\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - encryptedPrivateKey: '{"ciphertext":"4bb789bbdaa33f355800c4b8d14e75f310050a0269961b1f4b64c820756ce3595ac737fba749f0b268c418b19cb32f5ccd476bddec8d252ea4cd8e7cf15423a03cc00e9a2064e4134aba89524fe2018fb5ef6b27024a4dbe519883e6f41b462608c33914e129fd651e88d0f14973b3305f8e9d1e3d95670263b1b36921a1b5052f43282768a7210c7b66d5f5886359526cb56f48c61fd3cb165ba15b36f47611d1af8c2aa6d34eec0966d1aaa5522bc2291a5a962585218b4cca7a8d4081aed274ca8ceef95596583683b212549f0568a78b9116a4847d94d32488a0c4ecb9a9b5045afcebc9bcf9d3406fbb4d7eba89f21efce27e3ac174941768008f9d67842efb65e1f3f658a9b366c5c164b5cde2c2db442421c39d46e6017be35bb5b73b06a1569b35e8c4814e0edc1f1be46a964b5a4d9a8245694e530c43e9dbfb9176c41731b315f53b46138c270b6faaec8562abfdf7b595284de89d75bfb87e977330e943788ff914636a2cb81da54dcbaaaa39bd06929020dddcd3b628c44a91a3985f527a9b4592bda19aee4da3e3ee6bc73f98d6de843315476b1f67f8b8174db7b985b94c88c0686b4fd42b45ba398a46638b8d0cde5caa22f45fa51c749377baf35358ee2c1c057dd85b550194f4436af0a43c7c5f36bd7620f28a5ccfa28f16732a4992ff9345a863f1a8f48e5312ef5927b2af2890fee50ad219b43a88781e4b007572e4b7abf5fc5b41e3b944bb164f6c9a397495c46da239b0d40aad8d5bd17a5d02a032212f6495c2f4b8287a0e2d4b7a7d4a56114becb7a26e87233ec3201c558e6f42bc74414b34ec39ada6ab64f7ba9c47e0ddbbe5a622045b236b4a137adbeeeea3559b7b8873d727f7707f75a60a3310a54080eb00e59d6fce88ffd079ac9bf3c85f4fcdb56355bdb8b0b844f42526f4b624591a1729d5b7bed31c1affb0a95266e1092afd45f5c2466a2a7234f8481b8526180ae854e6b9b5e2a2835aef5dfba36ede0c01a56eda4aea27dc415f3ef1440ed0b8f8ae805544d3f4e24d0c9ee8b4ed6def38c7a545cfdc32b3efcf3ad321fab80a15b19c5710198f97826321b69c7677bcf5cae6218279f4bf9192b4ea77e510b7409b31e7b50c4b2dee85857ecf42f3b12365ac73c41d7bbe0564c8d741128c0723619a48ac29760c1a9eff36c179b50e6be26b4e10432cf6b8f987838450189a9474e20bc10adfcaacd1199c026cecb9d8b905bf9a2216345ef532e7cf3b94bc6962b4ac1cf52ed86547aaac352d2ce3a294ccd7299221722cd2852b7c5120dad85e041b09709b49e29e2fa17e6e94c0a77c0508ae805f4ecd0fc70b3ff78cd38ada6d8ddb9b150677589ab5b77968bafdf9f8cbfb0c7ec85d35c004b7d74dab2b3c235069276422878d6c0967ed051b03f05ae70ee8f054eb25054ece32f548c48671aa2b0206f61261f3ce8f44e2754f505ea29d879a1842531e7f2c37333be6c34178c4ccde01fa79f344809e0bddf8aa07e4614e4ed31b4d2fb4dff0b97cb33305afaff864ded85b13a69de4b421f331471595df86e6a8a6bf0c64bd00a7b8521614d00e0120895ce81355285fbbdfde434df2846fb062d5e309fe58df0ebc568378ccee69d6f86aeaed2a65e3ff477812692316535f52b927da1ae3a3cd49ed49fc19988e2759f7252510af3d6f3b4b444d838c24df9627b3cbaef01707de84182c1440c736d5432da40a9ba9d493917c82f3b6475a2d2b82e77dc72111ed454b7cd6fe0d0b0f68512fe9538898060043dc9ed2995a1f8df00ac7b58fd8f9d169225c66b527b5447cf597a2c785b8777aeb2054e2c95106f701d1645bdbee9a1c48649e51dd7ceeb611a99cbd85f8e9f8fae2bdce1a46023eff7bf6748434117624a9002eaf2d1feee0b5d4519706a7fd04b7fa497a0f5e152d5387b010fce47b7df330c12b9091848976cc1aef5b50f93bc2332e320bc46d01c891fedce914141805e74c3f912dbf2991aa927eddec4ec2a80cd3acdb5946764ae5da7759f142420567cf51172b37a50d827e4f463c51a9fd6dd47139c8acba1dbd6036dd4ce6af0e5e37ddc6b2c37dfe3d1482d0f695268e842e980cdb2d6d3541856f7780b216012ac67363cdf9907626ac81fd498cd133150c95aa5832ad4119fbdab0bc8ac0012c7217558e52de5e9a0dc779cb7c013cb7a277849cb9e040d5b32d9c454317b59c8962a645540fa0d7ee59ce4468b697ffdd29c93d4db10bde567c9d2105553116860829e728e9510a4cf986a9857de09846fe78095a48787985ba2b95d2094798d9fa209b893e1874615b313b099550ad17f7050112ca81a8a3ef6c83f4c44a90b2ebe44c60d658f15ef773304ac2d715e7c061675c3abe58386a7a2803856009e5e8c495c7d3c97091ba82893899fd12fb127db0deb06aa5717c63a1f949b35be830c2a3f7731d3f41423aca7a3951c4b4ebc5e3d874c36b518276cb0c07c27952571691d4fc16655be7450b55b3587f0ce79695661d325bb6f736e20338556efc1191eab56f5a2479be34a4c7c8d58b1028def385eb0e60aed6b7e9dac35863aba918641eecb7d12cc55b858bfcaed15e330d6fc47c42e76a13e6671758d8f665aaea876191f51f335b48d1fca47dc3dbaf7a357eb3f1946d8b3073b925ba58b7886a68118d3fc5eea83c1650cb5842668f82eb3350efa6ae6f5002bef3c11c3e7f368489c5a93dec16b93817778941626f6ae7a14c6ce4e5512664b23845e0df4bb76aceb20931765106fdaefb0f749a5fee20cfe467b87dccc73dc66b652cf63ce97e8470b195ed7aec14a7c154f2a3563b8f5b3db7992499dc9795217be05148a21468b204cd025ead1cc1e4144728c9e910140d1d04225df4632fa71604bec728117791d4742c1e1006a0604601942f5852de872fef382378676f59fe6d704d1bd07b7ad0c797b6da17bd39d8b66f90d95d913d46686c3ce881c9136efe0445b1e87c2eb8cb2283532e617cf6a0c5f40fdff1fc25b8372c9d46295934a48ecb5d8a6bd5388b76a984d20a1934823501cc85b0b453bc8aa5a6f19502ca788f4ae5219e6470fd9cfc75a244cf2923cd05e1d9da40f21bdf3bbdeb4647cc82f5988d365dc2b4ae331db8e504cca746092c63f1e305b027e707c38e13c66f5d90553717f9f41cc2624d0c2cfbf814a2355d1e9dfeb06cee67b132425b4d0ec68bdc0fb058ce6c444fdd284995349379a2a17739f0859b7ce24e9b681aac2a78b5b65790aa0dc83aacc6607b15acbafcf7bf943cd3826ea64c765c6943fdbb11853abad1aa92aca6f34c0dd2002fac9f4293dc9cd776d882ccb6e1bc02eb1294e99a0cfadf3923fd9798927aa9754e0cc573ee57a20df72b08fd571ee093fac1cb074b9cc90d10ee909031fe0f3c0cd85f31871b7527d653f143cd71c2084c8a9d8354d98ca9e138eb9e813bb90bd71e58880f5b03da49218e77afc3a8802ae80770490233478c9ff149d1eda00df6af91a57f022e158d23f29c058c9183ee39c6dd86fdbdccc81851ad136fc2813c639e8b367dee11d7eb3efe8f57852f2629cdaa1586fd47150c8ecca8d1ac9cfbef23d2489a0cc515154a09b35717d029a5e7ff14d3969692281c71ebc1f8e21b6f77d724bfa60d75d3a77a54ff3043edf1339bc53fa4c2279c3068a47f8d57dea5481c6c1a3aea9938972dc00bf8b637dab25e7b01cffccce70ff15896e38bb160266370e58c61518b4de88ffa121d6f0c0c757c2585f89f456756176fcd2c18852b43231f9f3c439a338ba8052d1a498d92b9f329610f4a636abc3bec7e895b6244c2c013a1cb9c2661ea1679f2fcb931ab9ffc7d04674144a2012ecda09272d6bb83fe039cd472cd059d734137cc2cf017b1177a63b1c2db74c4b5a6ae9f65524b090c6857bfa9f05960b8dcbc6d4d340064ea6079cba74961dcb6a0f00b0de01863574158bc424cd3dcf14f43b067b3584aef99d5c4cd7831ed3e8608f3f31045c4c37d6b408f32d4590fef6435036164632698c880d22577bb1c521e01e96a57c5780665d97eb8c1b472f3a00c04362ce6f72bd9250958ed6970d411c38d616d90cdda53ab2a5621ad318cb5e23f923426c15c8dcf55d7f54a516fb0bf61fbca1e73ceb9d13742a200fa92bc06fdf8027f7fda8549cbc3f837cbf53f249225e2b7d11bb45f79ac946f9e236da16e080338bc0ec5cee88691dd9e5ea54c6079c325801e0ccc980443b652d8971bca1fd253f078da4390eef90d975460a1300a92936a2097b3529e3316efcc11b398ca5ca7128431f438b4756ca3f690844a4ebbc133f8ebcf030ad7839daebd8e9a10724754fb5d4ae289a9637932ae3dafc5b8d6017648305b1eb4d43b16e58eae02fb9501a56ba23f0c27bc9a800120b018cc69f1a070da2936a5af9cd25ba1aa64eae66b218c8964f2b38c371c8a25c04a353d228fc59f08602fbf74a98e61ba3d2a34a844bc829d5f1ee1eaf1bb1cacca386496e22eaf171f1145695f759062f9fa254c5d8c103ff26f1cd73b1c7fd0ced091c917cb63d2fc98ff2e1437b802fd60d6d72b146b695dc93d646913bb9ffc763d604ec61fa733aefd5f14c465cb1ac85a6a1bbc34fc2204876b76c631725690155eaa5d8f07648f22fe954b3b121c56046c24e99e3ab5b2bf10dbd85505d8f55a1cf985ecdf4a42b6d031ea322ac969f86acc6d3a8ba3f5361b6e05b86374bd43d707293c27993a5ac7595a0d5348332dc13c6b651b4a859702844cbded3c6bd35aa67c8fdfc4e913a8b8615ce28129aecf3217ecc4c2bfc48607b650c47bec3365e1af941b9046958b7c8b64bf45028760984336b6c27bc044a7ea69385805d089434190f0044d856ad2fbad4965846f59491e37f0256548d82145f571e18090b0fa91","salt":"d2deba0a43769862a0fbd80dd6fc867599706ca644920fe1bc05585f922b518e","nonce":"74e9fa0359646cdfbe86a7ad","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"358718727d4b43422a7719176c09b66f633e52a47ee3879d1e19b85cc362938d"}', - verificationProof: 'eip191v2:0xd7f0bc7c3960f84280c1433e27c0110dea4b4af1a8c10f7531b8194625cada9456cb67117154f20e97a3d8764b8e3e276d0e6da44f36c4a89a06da9a76d3821a1c', - msgSent: 1, - maxMsgPersisted: 1000, - profile: { - name: 'Bob The Builder', - desc: null, - picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAnUlEQVR4AcXBQQ0CMBBE0c+kSXVUBWdMoGRl1AsSkLIWuO4Jrj2VNCTMe5fr9fFmI7L4xRydHWEmzIRZ49AcnZ3I4oQwE2bCrEUWJyKLE5HFjjATZsKszdFZRRarOTq/iCxWc3RWwkyYCbPGF5HFao7OTmRxQpgJM2HWIot/iixWwkyYCbM2R+fE/fVkZ44bJ4SZMBNmwkyYCTNh9gEzZiOL39d+3QAAAABJRU5ErkJggg==', - blockedUsersList: [], - verificationProof: 'pgpv2:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk9vdaCZDzsIc63rzcLRYhBLvWJU1IWhvs+frC7POwhzre\n' + - 'vNwtAAB5dAf/cDGsyD3YabE6iTIhNPDn+hvbHuZUjpNPnnSb+mjrvD/XBNYV\n' + - 'ITTHhp3Xy4Kuk19BkgmPO3O5TZHVUXK7IwYJd7uutNJJyLEWZYI9ttfeJ9cY\n' + - 'HQM3GjApAHycDkBAn5ZRDtmruyWipeE1II3omDUgChQOnQFoK/jWohoIOUvO\n' + - 'zi+0V02z7uIGwgTjBLgOYehD8NloGxTjwaZHMqEN7xbr1mZqy82Aew1Bw+EY\n' + - '+JPMyiKTF6HXHYrJZL1yaNw/T7ukCI8ecGoql04xlOHU+SKUTz+8Kcg4tZQR\n' + - '0pp6Fz9Fy9ROUI8ieu5LytJwQq4c9VkH/SPUvkoODloXc0MbrY59tA==\n' + - '=A3pG\n' + - '-----END PGP SIGNATURE-----\n' - }, - origin: null, - name: 'Bob The Builder', - about: null, - profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAnUlEQVR4AcXBQQ0CMBBE0c+kSXVUBWdMoGRl1AsSkLIWuO4Jrj2VNCTMe5fr9fFmI7L4xRydHWEmzIRZ49AcnZ3I4oQwE2bCrEUWJyKLE5HFjjATZsKszdFZRRarOTq/iCxWc3RWwkyYCbPGF5HFao7OTmRxQpgJM2HWIot/iixWwkyYCbM2R+fE/fVkZ44bJ4SZMBNmwkyYCTNh9gEzZiOL39d+3QAAAABJRU5ErkJggg==', - numMsg: 1, - allowedNumMsg: 1000, - encryptionType: 'eip191-aes256-gcm-hkdf-sha256', - signature: '0xd7f0bc7c3960f84280c1433e27c0110dea4b4af1a8c10f7531b8194625cada9456cb67117154f20e97a3d8764b8e3e276d0e6da44f36c4a89a06da9a76d3821a1c', - sigType: 'eip191v2', - encryptedPassword: null, - nftOwner: null, - linkedListHash: null, - nfts: null + "event": "chat.accept", + "origin": "self", + "timestamp": "1696576962016", + "chatId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa", + "from": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "to": [ + "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05" + ], + "message": { + "type": null, + "content": null + }, + "meta": { + "group": false + }, + "reference": null, + "raw": { + "fromCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "toCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "fromDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "toDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "encType": "", + "encryptedSecret": null, + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRAMkuwWk00HQxYhBKHMQtCl0iVWLJla7QyS7BaT\nTQdDAAAE+Af/U8h9c2tBPq6PjvDvjjs+yL/qTadagegzLZN0Gd9pT1kAmZ50\n+J1+f05oLCFdFcVTFz8dFZpueh+0s/8daXJ1uKVTBPPpfvWRInkD2KxlRrMu\n6gry3Tr2Fb1k8nIulIB/GSs7A85jJZQaG5WShZmfvg03bMadNIYmgl3ACmEe\nX3VovLFM5VLzuzKJGTn+7OM1VrZlZdsMRa7nfIdMKafMEEJcr41bmXCeYfzN\nw24kEO9/tAGaHzSRLsoNYxYDjby45OU1AJUHaLwjInk0klugcw7GWfMM3r2u\nE8qDuDZ0eveI6yArosK9amBlGF26l4UhEVPbCpumMrBBoItU03MPRw==\n=InOB\n-----END PGP SIGNATURE-----\n", + "sigType": "pgp", + "verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XBCRAMkuwWk00HQxYhBKHMQtCl0iVWLJla7QyS7BaT\nTQdDAAAE+Af/U8h9c2tBPq6PjvDvjjs+yL/qTadagegzLZN0Gd9pT1kAmZ50\n+J1+f05oLCFdFcVTFz8dFZpueh+0s/8daXJ1uKVTBPPpfvWRInkD2KxlRrMu\n6gry3Tr2Fb1k8nIulIB/GSs7A85jJZQaG5WShZmfvg03bMadNIYmgl3ACmEe\nX3VovLFM5VLzuzKJGTn+7OM1VrZlZdsMRa7nfIdMKafMEEJcr41bmXCeYfzN\nw24kEO9/tAGaHzSRLsoNYxYDjby45OU1AJUHaLwjInk0klugcw7GWfMM3r2u\nE8qDuDZ0eveI6yArosK9amBlGF26l4UhEVPbCpumMrBBoItU03MPRw==\n=InOB\n-----END PGP SIGNATURE-----\n", + "previousReference": null + } +} + ``` +</details> + +--- +<details> + <summary><b>Expected response (Chat Message Stream)</b></summary> + +```tsx +{ + "event": "chat.message", + "origin": "other", + "timestamp": "1696576962232", + "chatId": "b6f53ac38d0698ea64e6c4b0f024437ac2271ca869413d5f779d7cda75de1aaa", + "from": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "to": [ + "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899" + ], + "message": { + "type": "Text", + "content": "Hey There!!!" + }, + "meta": { + "group": false + }, + "reference": "bafyreich6wtnzojmgqft6eudx43y4xir2emfnhxqlvyy7rq6a73w7szywe", + "raw": { + "fromCAIP10": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "toCAIP10": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "fromDID": "eip155:0x0aF73cF3b072E39A46D78E6c4fbaA058A138Bc05", + "toDID": "eip155:0x52C6050536a77A405F03b6Da3F98Db9Ca69ad899", + "encType": "pgp", + "encryptedSecret": "-----BEGIN PGP MESSAGE-----\n\nwcBMAyaG8qwtJd4vAQf9Fg4udBKFN/Pqd9+bi5dqGnLr/PJbRHaIljRlzt5R\nm+6sPUeGyVkXcFdGbSnUKG0M7rtwKVOg0LiCX/oFx//k6ULJWJNVpuZsy4QT\nGYZevcU6dEPMMw4KSG/KJb+sdTAqlRPegibfrfg7YK/Mr9xd0DbN8K9CFsqC\nW/CYz0AkgZS/wN2099cy9WEgesv9yHMd1tU+59A/gAjmI5qk1ge3PvReKGP/\ncSWCX4wz0lioviib7g9zdw79ecpJThmWXKWaW/dPikcNYUTCbK31gY9TuRsy\nS+z+7AdddGj0hqgQvZIfj4XHgHbpQrRisddbgc1AE1xV7eiiT2jtNPswtsat\n48HATAOhR72eaWLr8wEIAJ06+SdpAuQT6mdlIAo/Kttiyd71UkxgMlappQKQ\nM5e2aei/H/C93EFYIitVHobeH/Q8Y89k4E+Plopo23OS6TGGbWIUl0PSJkyg\nxAIyC8J4RfqylCp+k/d9ZxZP/l0WrrXo9SqGOfXnAVm/IITLl8hlG7dvSztI\ng8ndUrk8Af3Jwq4vbrbUOMr2ophzV027HVWQl53Dez/e+DfpuyvT2uDAevTw\nf82H0+2DIz3jzj3rNfkvyA6C3InhW37K4JNh+T3XlL7qWV77XTWFN0yLzZwP\nrW0hLWV5YGAj0kqpup5oY4H1ANPknRiNxP6hUrQH5ZkHPahEUo78gpP70qgc\nZafSQAHfRbVWZC7J+0OF15W+dR3iM8Ngrz/PjYEchVo73a8uBtNk4mSai8o7\nv1A2hx74RVX6yN05D8Bxpf6u7wQMXB8=\n=T81R\n-----END PGP MESSAGE-----\n", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XCCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AAB/NQf/bwUkzVHV6/ODTtnjeA0y0kqEv3OAzbYoG60QdgNf3zAEmFbk\nf4ULNghzvl3Nt3S7TYsF06xu4gzzsjaOt8glPxJCiZUa3lXdJH53X5+VCbZV\nSWJuip9tdljAv4zg27+ZAGrwyC4NrTHE8t1b8mDHLTgJeqae6dJHjScmCXKZ\ngBZb2mNeVYWklg1mpCuXxB8YJpeFKDgSYeZ3C+YNSGAmoCyICRpYvxYo038P\nDehkFMS3HHvSGjFslcDN0D9l8gWY/4H520Rfer4GHJoFMSZeKlyWkQRCNPNz\nFY3fjmPLuimbEnnzd9Nxw1kbx4P9SBEEa4xhEjJnxx/sAnQxJX72RQ==\n=1zuZ\n-----END PGP SIGNATURE-----\n", + "sigType": "pgpv2", + "verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7XCCRCfItQMnVG/eBYhBKTq6JYHJG7fZv5Yop8i1Ayd\nUb94AACE2wf9GQq+/lkGQ7HVVmLF3SnSRI0IM9s4OvLckwjyd1i3D1lLnwu5\nVaPj+VxKZSBe+GHHukd/gQ+qYr9fhfHNMQ019AfHfz81kCCai6KhExH3YVbE\nsrL+j2bwttfcRjRWy/MoHo1T6M9F8PR4jm4aaktTSliApRE0k92Igm8Gw5it\nUaP1/qDIOQRjlofa7wAyDz7Kf83/WkbS78+MJZP0JWL9znhdFH5em8RvVYpS\nMa7/Skl8BnCr46BIfcd4Urd9q/RECKA4WJaxpOosH42MJQ4DLJ2iRnzZKkyr\nyZBfXXyiMA5goy+uzJzVhA5tlsHZp3jUFEZSvofaMX6a5UopweHMGw==\n=Wp+E\n-----END PGP SIGNATURE-----\n", + "previousReference": "bafyreid7b7m5ub3ouybgp2nzu733vle73bem5jcz5lg5u2epknncfhfeuy" + } +} +``` +</details> + +--- + +<details> + <summary><b>Expected response (Chat Rejection Stream)</b></summary> + ```tsx + { + "event": "chat.reject", + "origin": "self", + "timestamp": "1696577053528", + "chatId": "e819ff24ee06d44927bdc0c0967bd55b6410d389c29c72c329dcce4dca9f413d", + "from": "eip155:0xd49F5038C4baA79DF1f1191d6B18FF55D06a4648", + "to": [ + "eip155:0x1fd48A2697Bdfd5A63436cEf5548e095649B65a7" + ], + "message": { + "type": null, + "content": null + }, + "meta": { + "group": false + }, + "reference": null, + "raw": { + "fromCAIP10": "eip155:0xd49F5038C4baA79DF1f1191d6B18FF55D06a4648", + "toCAIP10": "eip155:0x1fd48A2697Bdfd5A63436cEf5548e095649B65a7", + "fromDID": "eip155:0xd49F5038C4baA79DF1f1191d6B18FF55D06a4648", + "toDID": "eip155:0x1fd48A2697Bdfd5A63436cEf5548e095649B65a7", + "encType": "", + "encryptedSecret": null, + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7YdCRCAVGEKwfvuDBYhBDuMv0sczhcV+XqGZYBUYQrB\n++4MAACNGQf/UM17dLBNzMLEmhfThqnxdXo1w1n4U/1DCSmzavvJ2CmCXvTU\nfekuTaxEEGQ83yKeI85KEkHdKgYpNmNa7O5OfOekjum4kRLi8qo4yVH6uard\nEiV+r4i52gWAqdrZOuFqWOLpbtWzMXF3gl6f+Sq5VT/SIi2/g5lO/bYd4QFX\n7cm/J+M5MzDJvxDht29bwDMylJVJXYr93xsEsLUAG0xo71mzsnEc7aSCxY71\nGw+4/KstoSDT40pvoZLw7qRidmHOt5QLHI6wpcztdo8ALDByYpIifV/J7lao\ns4bDS0TOXCb8/F6MQt2SXRKD8pIvzQ3CZBBZSKg+29Muq7Gw8hDq/A==\n=lcfd\n-----END PGP SIGNATURE-----\n", + "sigType": "pgp", + "verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7YdCRCAVGEKwfvuDBYhBDuMv0sczhcV+XqGZYBUYQrB\n++4MAACNGQf/UM17dLBNzMLEmhfThqnxdXo1w1n4U/1DCSmzavvJ2CmCXvTU\nfekuTaxEEGQ83yKeI85KEkHdKgYpNmNa7O5OfOekjum4kRLi8qo4yVH6uard\nEiV+r4i52gWAqdrZOuFqWOLpbtWzMXF3gl6f+Sq5VT/SIi2/g5lO/bYd4QFX\n7cm/J+M5MzDJvxDht29bwDMylJVJXYr93xsEsLUAG0xo71mzsnEc7aSCxY71\nGw+4/KstoSDT40pvoZLw7qRidmHOt5QLHI6wpcztdo8ALDByYpIifV/J7lao\ns4bDS0TOXCb8/F6MQt2SXRKD8pIvzQ3CZBBZSKg+29Muq7Gw8hDq/A==\n=lcfd\n-----END PGP SIGNATURE-----\n", + "previousReference": null + } +} + ``` +</details> + +--- + +<details> + <summary><b>Expected response (Group Chat Message)</b></summary> + + ```tsx + { + "event": "chat.message", + "origin": "self", + "timestamp": "1696576220066", + "chatId": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0", + "from": "eip155:0x9d57759F2D0cbf19D6cfAf72C5A4c4B1A2443500", + "to": [ + "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0" + ], + "message": { + "type": "Text", + "content": "Hello" + }, + "meta": { + "group": true + }, + "reference": "bafyreidheq2764lxdi2plbp4mik24ohtjfyvfbmkde2wsb2ahvwdjrwygq", + "raw": { + "fromCAIP10": "eip155:0x9d57759F2D0cbf19D6cfAf72C5A4c4B1A2443500", + "toCAIP10": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0", + "fromDID": "eip155:0x9d57759F2D0cbf19D6cfAf72C5A4c4B1A2443500", + "toDID": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0", + "encType": "PlainText", + "encryptedSecret": "", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LcCRBG3kV4UbDyWhYhBPyPo+yD4wbsNV5YNkbeRXhR\nsPJaAABWfAf+MQFE/qy3X8R19wQeQ90eu6rYtK1h5aVlLwezo4z8F/8KqK1S\nwr8tlrtlQ9TieNH6Q5xebM2K356R44QnmE3qZB52Ukww2hiyrrCu7+x55KzK\na1+P8bQh1bGiesBYOa3LqnFlnFyQgBFJvGQqI0m2QBDbkM5OTkQGUYSi4tnO\nYIxVplb/lhEYHt/ZRGu1xg0XMhgycsRESidNLldKRx+AooeGfWgNIws97Yaq\nBbGTEgNOul8XV8b7y2ORL74Dl18UMPRF91dyktm/y8FJp30rWHaeNMAgKzlX\nr/nSgXFtCkfxclQgbBlSit1PBHmhB/Sr0amZKelpiYdRT+lVluknLg==\n=/QXX\n-----END PGP SIGNATURE-----\n", + "sigType": "pgpv2", + "verificationProof": "pgpv2:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LcCRBG3kV4UbDyWhYhBPyPo+yD4wbsNV5YNkbeRXhR\nsPJaAAAHQQf/eb4aaRUTbcAwLRWlI+55Ddd1PBeWXhTyDIZgsiFYUwSmtLLd\n/bFHnQzyplo+Tp8BuUB+wO5dH112ousWxOeTj8yAGUve6OhbP/8g9nJmHecJ\nmZwAHPhr4BVYomQRQChLp8FstLLjiI3CNdfarIYzBmlWGhrurXltjx69e+Ef\nyxtxRZ6zZavG56IHhOJru0p3y1nsbNI5eGsXG9Wq3FdAUXhbsOizxDCAdqN/\nfzOmqnZGMKsk6DNQ1471txAGujbg29i9o41lxYGcuNYYMal0CEceawfMXDH8\n8T2fbILXRZzpX/I+dlArPMDHqLdfNu2uLwYOmq+aTv7qUm3t1SkR0w==\n=+0T5\n-----END PGP SIGNATURE-----\n", + "previousReference": null + } +} + ``` +</details> + + +--- + +<details> + <summary><b>Expected response (Group Chat Request)</b></summary> + + ```tsx + { + "origin": "self", + "timestamp": 1696576021653, + "chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "to": [ + "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db", + "eip155:0x1b77273e527Ec5948995f395e3ADa41E708d617e", + "eip155:0x7711FED1Bc6B1E461aE7869959bdBf529335db5A" + ], + "event": "chat.request", + "meta": { + "group": true + }, + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAAD//wf/bTrC0LnwzcUIE10d3XQ2Y56jK6kRVGWKR/7i6CC+hGs5PGKu\nzefIGdtLVjAqTeKn6PbNnb1t2niLhmMeTbN+knGCzSqx/FN8OodLLmunLNAx\nWJ5thFyjZWNyIF7IoH2zUdc8zbsjXHzfd70yoxMZSwd5C7EPj/e17kyYHdj2\nzPQecbTsnCIjJKzi0PBa2YMNoF5fExP3hwTnP0k693r8oC5ivxj7Ht3Hwmu0\njsv+sGXk+XZPC/JQQfEEviEh3j9dEiNIeHutk/7cFdEnDfEy5dFMxubjf6oH\nY6vt0q2V2CZJHHw99JYeTHN/d3YDXc4RggoUINo1cysR904owgEsVw==\n=QTX8\n-----END PGP SIGNATURE-----\n:0x136E326b22ED48dbB665733eC024407d4fAA4F12" + } +} + ``` + +</details> + +--- +<details> + <summary><b>Expected response (Group Chat Request Accepted)</b></summary> + +```tsx + { + "event": "chat.accept", + "origin": "other", + "timestamp": "1696576021843", + "chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db", + "to": null, + "message": { + "type": null, + "content": null + }, + "meta": { + "group": true + }, + "reference": null, + "raw": { + "fromCAIP10": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db", + "toCAIP10": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "fromDID": "eip155:0x3AD7cf4Ef82dd7f4f040c5eD7352f12C662F21db", + "toDID": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "encType": "", + "encryptedSecret": null, + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRA1c2iyC1q/7RYhBH5kgFyUQlfGEgbg0jVzaLIL\nWr/tAABinQf9E+7UUlPnAVu9VifNHS6GJuf/o1RJdE8gL4mi27+rdfr+Y2+Y\nzZaZbBEJK3BTJgT4op1yJKtg2GZDZUIMWSbkcouE+2YyyYsANS89z/blq/05\nYf6RFuUeHr3pGIyzkeb7Aj7VEHbUhrK5nHheTkO7K6Gpa9blNEYVrhsYrHbs\n7UhYKlq6tsoo1E8XXFWBhd+2rVPKF4zhIt9jPdqNPYTQSn7K7hjVvZueWd0Z\nD7Vr4RO4Af3a/5EiVAvOtxVGLpwhw+FKDOGJhRdNCNLqEc8gZ0q+l1cvglKp\nfAiqSZpnnTzIUloszJvNFAeQSR/nZQ9wjEihosDztVOOz5uyQ3XhZw==\n=kX/p\n-----END PGP SIGNATURE-----\n", + "sigType": "pgp", + "verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRA1c2iyC1q/7RYhBH5kgFyUQlfGEgbg0jVzaLIL\nWr/tAABinQf9E+7UUlPnAVu9VifNHS6GJuf/o1RJdE8gL4mi27+rdfr+Y2+Y\nzZaZbBEJK3BTJgT4op1yJKtg2GZDZUIMWSbkcouE+2YyyYsANS89z/blq/05\nYf6RFuUeHr3pGIyzkeb7Aj7VEHbUhrK5nHheTkO7K6Gpa9blNEYVrhsYrHbs\n7UhYKlq6tsoo1E8XXFWBhd+2rVPKF4zhIt9jPdqNPYTQSn7K7hjVvZueWd0Z\nD7Vr4RO4Af3a/5EiVAvOtxVGLpwhw+FKDOGJhRdNCNLqEc8gZ0q+l1cvglKp\nfAiqSZpnnTzIUloszJvNFAeQSR/nZQ9wjEihosDztVOOz5uyQ3XhZw==\n=kX/p\n-----END PGP SIGNATURE-----\n", + "previousReference": null + } } ``` +</details> -| Parameter | Type | Remarks | -| ------------------- | -------- | --------------------------------------------------------------- | -| did | `string` | user decentralized identity | -| wallets | `string` | all wallets associated to the did | -| publicKey | `string` | Public PGP key | -| encryptedPrivateKey | `string` | Encrypted PGP Private Key | -| verificationProof | `string` | Verification proof | -| msgSent | `number` | Number of messages sent | -| maxMsgPersisted | `number` | Maximum number of messages that can be persisted | -| profile | `object` | User profile information | -| origin | `string` | Origin information (source of the data) | -| name | `string` | Profile Name ( Deprecated ) | -| about | `string` | Profile Description ( Deprecated ) | -| profilePicture | `string` | Profile Picture ( Deprecated ) | -| numMsg | `number` | Number of messages sent ( Deprecated ) | -| allowedNumMsg | `number` | Maximum number of messages that can be persisted ( Deprecated ) | -| encryptionType | `string` | Type of encryption used | -| signature | `string` | Account signature ( Deprecated ) | -| sigType | `string` | Type of signature ( Dprecated ) | -| encryptedPassword | `null` | Encrypted user password ( Deprecated ) | -| nftOwner | `null` | Owner of NFT ( Deprecated ) | -| linkedListHash | `null` | Deprecated | -| nfts | `null` | Information about owned NFTs( Dprecated ) | +--- + +<details> + <summary><b>Expected response (Group Chat Request Rejected)</b></summary> + +```tsx +{ + "event": "chat.reject", + "origin": "other", + "timestamp": "1696576601599", + "chatId": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791", + "from": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13", + "to": null, + "message": { + "type": null, + "content": null + }, + "meta": { + "group": true + }, + "reference": null, + "raw": { + "fromCAIP10": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13", + "toCAIP10": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791", + "fromDID": "eip155:0x15d8a67c0B1eb61dA5901109DB4CA382E989aA13", + "toDID": "7a200d55cc76428e9938e935b604e993c5f6cb2f3e9a1dd7108a07dd32de0791", + "encType": "", + "encryptedSecret": null, + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7RZCRA8vrXKPfPlwRYhBECQe8HJcpH3IRX27jy+tco9\n8+XBAADl0Af7BumEnrIcSj/1H3LvxaqG4wK/G6iTP3iTvXUca0n7UBplXS8P\nbKV7XFhjollN6jJVZ53mmUHgNDAbfaQTvutm3SRJlFVJxV4zV9uL7UMZW+k4\nYAJM5XNbqqyn7+KjcLIwBpJ3YLMmmLfdrO4+WJAYswAAJGiS+KPDsU+oOsfm\nHMWc5aRqis0Epf3FLWELO0uDyydm75575bBe60FxfPjnd5GhUgmMWydNCZH1\ngeGMLZbhuQ+bvnLjTuWSmnW64cl+jlRCzs2Mpgwvrh0ZQIcPWjVDjNevNohu\n3l9VXhHuYPUCyGGIyhcPG3tubRcudY+U/uavhQ6XXgWPVdKZ/qwfAw==\n=0jOy\n-----END PGP SIGNATURE-----\n", + "sigType": "pgp", + "verificationProof": "pgp-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7RZCRA8vrXKPfPlwRYhBECQe8HJcpH3IRX27jy+tco9\n8+XBAADl0Af7BumEnrIcSj/1H3LvxaqG4wK/G6iTP3iTvXUca0n7UBplXS8P\nbKV7XFhjollN6jJVZ53mmUHgNDAbfaQTvutm3SRJlFVJxV4zV9uL7UMZW+k4\nYAJM5XNbqqyn7+KjcLIwBpJ3YLMmmLfdrO4+WJAYswAAJGiS+KPDsU+oOsfm\nHMWc5aRqis0Epf3FLWELO0uDyydm75575bBe60FxfPjnd5GhUgmMWydNCZH1\ngeGMLZbhuQ+bvnLjTuWSmnW64cl+jlRCzs2Mpgwvrh0ZQIcPWjVDjNevNohu\n3l9VXhHuYPUCyGGIyhcPG3tubRcudY+U/uavhQ6XXgWPVdKZ/qwfAw==\n=0jOy\n-----END PGP SIGNATURE-----\n", + "previousReference": null + } +} +``` </details> --- -### **Create Group** +<details> + <summary><b>Expected response (Participant is Removed from a Group)</b></summary> -```typescript -// Create a Group -const createdGroup = await userAlice.chat.group.create(groupName, { - description: groupDescription, - image: groupImage, - members: [walletAddress1, walletAddress2, walletAddress3], - admins: [], - private: false, -}); +```tsx +{ + "origin": "other", + "timestamp": 1696576219688, + "chatId": "a64abd4256a607e7bd2ab4068d9024ddb0d355687267c0e39eb31a3a7d245ab0", + "from": "eip155:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855", + "to": [ + "eip155:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855" + ], + "event": "chat.group.participant.remove", + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7LbCRByYd40HdgiDBYhBLSq7nZZRBYzsnezMXJh3jQd\n2CIMAADNoAf/UxniQM/ZtzDuSmhIuvWiuGzl8vkeFbN2dOLW1a2yJO2Z8jDa\nDDuxyTcSt9d9YyCO/NojhbxmScE73gBysVt9OLdUn9hXlAKclYjXu4r7KvLk\nmrQyMlN3akDjpzH1gGiiCSi18vll07KRGSgWt3P13cA9vGpT+YV3A6uiCGUS\nE3CV16wdYTd0FUPJHckTJVVu3se1K3NfzzELMwIeN9bPJLxaZD3u3t074dN/\nc+jwUS1OC0sUQ5ptHCgfNIMgtueutKSPPZO6MKVBE/qQauKh81PHgzrhW0OE\n6gMkSDPjVbncjBSumofTWga7udk65RhwysCxx9qa3O/u6skBH0N+bg==\n=oqeR\n-----END PGP SIGNATURE-----\n:0x50bbFA4833e89389FE00a62D14E6eDDf1c155855" + } +} ``` +</details> -| Param | Type | Default | Remarks | -| ----------------------------------- | ---------- | ------- | ------------------------------------------ | -| `name` | `string` | - | The name of the group to be created. | -| `options` \* | `object` | - | Optional Configuration for creating group. | -| `options.description` \* | `string` | - | A description of the group. | -| `options.image` \* | `string` | - | Image for the group. | -| `options.members` \* | `string[]` | `[]` | An array of member DID. | -| `options.admins` \* | `string[]` | - | An array of admin DID. | -| `options.private` \* | `boolean` | `false` | Indicates if the group is private. | -| `options.rules.entry.conditions` \* | `any[]` | - | Conditions for entry to the group. | -| `options.rules.chat.conditions` \* | `any[]` | - | Conditions for chat within the group. | - -\* - Optional +--- <details> + <summary><b>Expected response (Participant Joins a Group)</b></summary> - <summary><b>Expected response</b></summary> +```tsx +{ + "origin": "other", + "timestamp": 1696576531987, + "chatId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82", + "from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581", + "to": null, + "event": "chat.group.participant.join", + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581" + } +} +``` +</details> -```typescript +--- + +<details> + <summary><b>Expected response (Participant Leaves a Group)</b></summary> + +```tsx { - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' + "origin": "other", + "timestamp": 1696576531987, + "chatId": "1032596dea9f24a7a0ee419668f7d39da32a2fb32003a27c6b293cc6668d2a82", + "from": "eip155:0x8c1EAB3227250526f133681630c2B191969f8581", + "to": null, + "event": "chat.group.participant.leave", + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7QTCRCI26TZ8c3OJBYhBNDtmDIWimjDn9MUIIjbpNnx\nzc4kAAAfFwgAgQkKBS/W7e53maVOne1lob2Qk14gWfUQm/LaRlP0iO5YwPlg\njckyQaX0Ient3PmLSqUoykuKWH2wR53YJ6Wgb//EkOxdywkrDbAZCGnQgxaO\nakTU30mDaV06HLQjDQmRTHdeozwV+6PF+i71vZPNmsCSI8x/VSex/gMrs2nk\nhSAHnuhUcuEWHshc+FXEO70acz8nkhH7Pw0icDwb50yFZNuekrK4rjUPmXb2\nwBzwFDjpfS6n8JMQz4//jYXyFuDfzYlr97ymWdltR5h8QKs1iZsN++X/5FsA\nO2EltMRqhxcpPApcHB9QQe6CAZFG+1fB8FKOXx6MZMwHqjyEtrL27Q==\n=bDP5\n-----END PGP SIGNATURE-----\n:0x8c1EAB3227250526f133681630c2B191969f8581" } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null +} +``` +</details> + +--- + +### **Stream Chat Ops Events** + +```tsx + // recevive stream realated to group creation and updation + userAlice.stream.on(STREAM.CHAT_OPS, (data: any) => { + console.log(data) + }) +``` + +<details> + <summary><b>Expected response (Group Created)</b></summary> + +```tsx + +{ + "event": "chat.group.create", + "origin": "self", + "timestamp": 1696576020848, + "chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "meta": { + "name": "test", + "description": "test", + "image": "test", + "owner": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "members": [], + "admins": [ + { + "address": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "profile": { + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsa2DMBSG0S+/3LJBKkZgjUzADi4sJEoqSkvIBSNEYhtG8BIMkNdeGqd4iu45j+f79aHh7HasY91oGZcJa7giLcKZcCacBb441g1rXCZajnXjJtEknAlnwlk4u52WIUWsfEWaEjdnt9MinAlnwlk41g0rp4o1l57/GFLEmkuPJZwJZ8JZ4IucKr8knAlnwlnIqWLNpcfKqWKd3U7LcEWsufRYOVUs4Uw4E87CXHqscZmwRu6GK9Jydjs3C3frhiWcCWfC2eP5fn0w5tLzSzlVLOFMOBPO/gCOGzPC9wXXhQAAAABJRU5ErkJggg==", + "publicKey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsBNBGUfshMBCADOFCC0uSjbBGbjJi5QWaEtDpv7PMGqA0kU+e2mHBvZgGM2\nimibNukifrDArM+oJL3/OnjQHwkF5L6W3oCnKwe1hwSiceLDf3uR0F5E+wWA\nEeFv3xPdYYpqbT9tdYXlOCJpoSJH2TM7mcvSECltpSOIYAWpD2E450kTTHCJ\nYDrnrMdPifrCTSrfh4X1pKkbdSDJIrHHeqVTDcUPZhZlbXdEypqK4u5wjEqe\nLc/AprwDyeDx+ltGAo4hmD3ojHGkckk7ctW9RmdqGBGCB/VaK35JT0Tp6AQ8\nrmKOejF4nxbH5eCzUX4vC6xz666gWGj2eGDnS5XCGaBtfWfvYvTCoe4HABEB\nAAHNAMLAigQQAQgAPgUCZR+yEwQLCQcICRAxpSc3atCeoAMVCAoEFgACAQIZ\nAQIbAwIeARYhBGHp9Ifk8vvLrMzkYTGlJzdq0J6gAABuBwgAvNkpwWQCoB8D\nFC56ir7s2tRlzpIUb+nnK5ygqpxp/Wvo1+TpFoWGkdUOC0ng9H98MrJmEh1k\nhLkaBv1VPQN6l+O7tjAyvWNA+JfKLaefxc6EB0KFUOZH1E/gFWc8b6+cciXZ\npAINmBW8+PPSlt1EYuo2UAXqEAOW4dlez8Z6OCf7c4L7+MZKVv2a5r3Cqfl2\nNHaI4lHQYabWt1tsoVyN7kyfZkENXQQv3LsJ7o98WK0FnfFEM/hA1I5jM8Ww\nf0qBukDmzOTxtgYDE7mo3xHNDpjptr8lk5oOFPsHCpOwgksAVKK4yHqy4aQe\nqXPBjBMmUBUuSlB/8KwI6FtX2JFm9s7ATQRlH7ITAQgAySkQBm6drDe5FJI1\nUe5QhoUXX8ugfXyCR7SoL4JMxVmhaO9/Fj/Swy1UoagONZYJZzcamJWnPzAR\nvfYBEzSEFGrkPKVdrJAM7Zf1sX5v+wpUtLTE6/gSCzAJMnK11pdgTHqEn+Rc\nfPuTnGYFZw3EybYMbhr/wBCyvFd49ES+8q3jrjHbMGS5lFCnVFYE/gyN9nqp\nSG0biMS7pl+w51bjIfJ9bRiUzrxpk5yvr9WDqMTVJA0N6ZRsD+xtkipc7XFe\nnsY0caCVVYFOH9YCiwuytC4ShU2VHjEPXcgzLTk9k5ecfE8AdwiYgLsWOHTn\nbz1JpwqYJx5Rndkb4vXdV6Pi7wARAQABwsB2BBgBCAAqBQJlH7ITCRAxpSc3\natCeoAIbDBYhBGHp9Ifk8vvLrMzkYTGlJzdq0J6gAACZvQgAyJrLhQ9/MsBU\n6E1ZwdKlKBWi62A4SBXRZJpRl2hBwagyNq7zbsX/yO7D7fW1FVLfcT28cmCe\nCUD6aa904dQ8GVDyuUqRsSXZZvZqFdddgNT7O8fCbIbMCihfz9Gg6mbxVHcy\nOby7nkOBbrKDBpIPab9yMHHYsycsPDo8/8cGI9RNZz06aAgOVGjfcMTuw8RR\nXWINBmTWn9I4xrylEtH7SQU9b0Alj2SxfV9N/+mMGGv/Zo3E99/a/p2DLExY\n/+dk0I9kxjxHkjtq49/tT00JYLDkHVtMgGxjl9n8Uv7KXFHkuGFg7gV9ivdN\n1phi4oalkdY5sqbd5GkUxM7M1VN6Xg==\n=nCF5\n-----END PGP PUBLIC KEY BLOCK-----\n" + } + } + ], + "pending": { + "members": [], + "admins": [] + }, + "private": false, + "rules": {} }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IUCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAADrLAgAgDSQ7CJ3ZVOPye++rkpyR4Q9XSGnV3Z0bqO+HCqFDW/hTmJ+\n12kjrAQV43Q1fQviIMqh+RTA9WJHPA14vu/ZYHjmCM/HfPSxbY4zV/7FJF9C\nCaEgq+wGs+2vhixHX4Zoo4qrxdXQ6q8Wl4XXW3SVaw1sGxfIh+uMje54Tsil\nnaLNK+lIPdSAJDw1hOHIM3iMWaSzZasLaXkJ6KY9KefW52mhg112BZI94FxJ\n/wFQtlIaXGZHhCbaqiigjRPKo17KyW7PX6I0rTAQJlwHyIKS/vIH8Uahi2x3\ndzjonpXjjtsgcP+VhzEP1jxQkpo4mG47Fxkxzp/Q7ztdSGHnJGlXkQ==\n=HydQ\n-----END PGP SIGNATURE-----\n" + } +} +``` +</details> + +--- + +<details> + <summary><b>Expected response (Group Updated)</b></summary> + +```tsx + +{ + "event": "chat.group.update", + "origin": "self", + "timestamp": 1696576021192, + "chatId": "3781b4193166ec8f0a1fabe162ef3f2458cac28516d4d20f8dd7faf446815900", + "from": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "meta": { + "name": "test", + "description": "Updated Description", + "image": "test", + "owner": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "members": [], + "admins": [ + { + "address": "eip155:0x136E326b22ED48dbB665733eC024407d4fAA4F12", + "profile": { + "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAA30lEQVR4AcXBsa2DMBSG0S+/3LJBKkZgjUzADi4sJEoqSkvIBSNEYhtG8BIMkNdeGqd4iu45j+f79aHh7HasY91oGZcJa7giLcKZcCacBb441g1rXCZajnXjJtEknAlnwlk4u52WIUWsfEWaEjdnt9MinAlnwlk41g0rp4o1l57/GFLEmkuPJZwJZ8JZ4IucKr8knAlnwlnIqWLNpcfKqWKd3U7LcEWsufRYOVUs4Uw4E87CXHqscZmwRu6GK9Jydjs3C3frhiWcCWfC2eP5fn0w5tLzSzlVLOFMOBPO/gCOGzPC9wXXhQAAAABJRU5ErkJggg==", + "publicKey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nxsBNBGUfshMBCADOFCC0uSjbBGbjJi5QWaEtDpv7PMGqA0kU+e2mHBvZgGM2\nimibNukifrDArM+oJL3/OnjQHwkF5L6W3oCnKwe1hwSiceLDf3uR0F5E+wWA\nEeFv3xPdYYpqbT9tdYXlOCJpoSJH2TM7mcvSECltpSOIYAWpD2E450kTTHCJ\nYDrnrMdPifrCTSrfh4X1pKkbdSDJIrHHeqVTDcUPZhZlbXdEypqK4u5wjEqe\nLc/AprwDyeDx+ltGAo4hmD3ojHGkckk7ctW9RmdqGBGCB/VaK35JT0Tp6AQ8\nrmKOejF4nxbH5eCzUX4vC6xz666gWGj2eGDnS5XCGaBtfWfvYvTCoe4HABEB\nAAHNAMLAigQQAQgAPgUCZR+yEwQLCQcICRAxpSc3atCeoAMVCAoEFgACAQIZ\nAQIbAwIeARYhBGHp9Ifk8vvLrMzkYTGlJzdq0J6gAABuBwgAvNkpwWQCoB8D\nFC56ir7s2tRlzpIUb+nnK5ygqpxp/Wvo1+TpFoWGkdUOC0ng9H98MrJmEh1k\nhLkaBv1VPQN6l+O7tjAyvWNA+JfKLaefxc6EB0KFUOZH1E/gFWc8b6+cciXZ\npAINmBW8+PPSlt1EYuo2UAXqEAOW4dlez8Z6OCf7c4L7+MZKVv2a5r3Cqfl2\nNHaI4lHQYabWt1tsoVyN7kyfZkENXQQv3LsJ7o98WK0FnfFEM/hA1I5jM8Ww\nf0qBukDmzOTxtgYDE7mo3xHNDpjptr8lk5oOFPsHCpOwgksAVKK4yHqy4aQe\nqXPBjBMmUBUuSlB/8KwI6FtX2JFm9s7ATQRlH7ITAQgAySkQBm6drDe5FJI1\nUe5QhoUXX8ugfXyCR7SoL4JMxVmhaO9/Fj/Swy1UoagONZYJZzcamJWnPzAR\nvfYBEzSEFGrkPKVdrJAM7Zf1sX5v+wpUtLTE6/gSCzAJMnK11pdgTHqEn+Rc\nfPuTnGYFZw3EybYMbhr/wBCyvFd49ES+8q3jrjHbMGS5lFCnVFYE/gyN9nqp\nSG0biMS7pl+w51bjIfJ9bRiUzrxpk5yvr9WDqMTVJA0N6ZRsD+xtkipc7XFe\nnsY0caCVVYFOH9YCiwuytC4ShU2VHjEPXcgzLTk9k5ecfE8AdwiYgLsWOHTn\nbz1JpwqYJx5Rndkb4vXdV6Pi7wARAQABwsB2BBgBCAAqBQJlH7ITCRAxpSc3\natCeoAIbDBYhBGHp9Ifk8vvLrMzkYTGlJzdq0J6gAACZvQgAyJrLhQ9/MsBU\n6E1ZwdKlKBWi62A4SBXRZJpRl2hBwagyNq7zbsX/yO7D7fW1FVLfcT28cmCe\nCUD6aa904dQ8GVDyuUqRsSXZZvZqFdddgNT7O8fCbIbMCihfz9Gg6mbxVHcy\nOby7nkOBbrKDBpIPab9yMHHYsycsPDo8/8cGI9RNZz06aAgOVGjfcMTuw8RR\nXWINBmTWn9I4xrylEtH7SQU9b0Alj2SxfV9N/+mMGGv/Zo3E99/a/p2DLExY\n/+dk0I9kxjxHkjtq49/tT00JYLDkHVtMgGxjl9n8Uv7KXFHkuGFg7gV9ivdN\n1phi4oalkdY5sqbd5GkUxM7M1VN6Xg==\n=nCF5\n-----END PGP PUBLIC KEY BLOCK-----\n" + } + } + ], + "pending": { + "members": [], + "admins": [] + }, + "private": false, + "rules": {} }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' + "raw": { + "verificationProof": "pgp:-----BEGIN PGP SIGNATURE-----\n\nwsBzBAEBCAAnBQJlH7IVCRAxpSc3atCeoBYhBGHp9Ifk8vvLrMzkYTGlJzdq\n0J6gAACfBQgAgDYEX8fSjArginDEbjDmMxQxmieIMt3/N2wTjWU/r8muAnNb\nIpijtAvftEkCoVnefXH9rlILr0rUGLwFXTsc6YYO6u9Tr1iODQQZopD8Bqtc\ntKE5RzRT6qS6QUQQP8YNlh/iqtTWCzdY7aYKGNWkrSOUKhu+iHKLIsEqNSf2\nYV9S9qksGWhK9xfsExkHjR0Df3yo/BUwpDKW/duiwBPgl99aUYunjAQyRRun\njlXmX6W+bEAlEmJABq5C9Tw+M/+j4AiBy57kdrxAQ6aKHnfGJafH7Xo8/BuN\nG6XJdNELJKug/5Xb+eWjO3JggGOD90fetTKcVdzGJPhXaVyIhL0e/A==\n=+sdF\n-----END PGP SIGNATURE-----\n:0x136E326b22ED48dbB665733eC024407d4fAA4F12" } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'create' } + ``` + </details> -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | +--- + +## PushNotification Class + +### **Initialize** + +```typescript +// Initialize PushAPI class instance +const userAlice = await PushAPI.initialize(signer, { + env: ENV.LOCAL, + streamOptions: { raw: true }, + }); +``` + + + +## Parameters + +| Param | Type | Default | Remarks | +| --------------------------------------- | ------------------------------------------------- | ------------- | -------------------------------------------------------------------------------------- | +| `signer` | `SignerType` | - | EthersV5 or Viem Signer. | +| `options` \* | `PushAPIInitializeProps` | - | Optional configuration properties for initializing the PushAPI. | +| `options.env` \* | `ENV` | `staging` | API env - 'prod', 'staging', 'dev'. | +| `options.progressHook`\* | `(progress: ProgressHookType) => void` | - | A callback function to receive progress updates during initialization. | +| `options.account` \* | `string` | - | The account to associate with the PushAPI. If not provided, it is derived from signer. | +| `options.version` \* | `string` | `ENC_TYPE_V3` | The encryption version to use for the PushAPI. | +| `options.versionMeta` \* | `{ NFTPGP_V1 ?: password: string }` | - | Metadata related to the encryption version, including a password if needed. | +| `options.autoUpgrade` \* | `boolean` | `true` | If `true`, upgrades encryption keys to the latest encryption version. | +| `options.origin` \* | `string` | - | Specify origin or source while creating a Push Profile. | +| `options.streamOptions` \* | `PushStreamInitializeProps` | - | Configuration options for the stream. | +| `options.streamOptions.listen` \* | `STREAM[]` | - | Specifies which streams to listen to. | +| `options.streamOptions.filter` \* | `{ channels?: string[]; chats?: string[]; }` | - | Specifies which channels or chats to filter for. | +| `options.streamOptions.connection` \* | `{ auto?: boolean; retries?: number; }` | - | Connection settings, including auto-connect and number of retries. | +| `options.streamOptions.raw` \* | `boolean` | - | If set to `true`, will provide raw stream data. | +| `options.streamOptions.enabled` \* | `boolean` | - | Specifies if the stream is enabled or not. | + + + + +\* - Optional + +## STREAM Options + +| Option | Value | +|-----------------------|------------------------| +| `PROFILE` | `STREAM.PROFILE` | +| `ENCRYPTION` | `STREAM.ENCRYPTION` | +| `NOTIF` | `STREAM.NOTIF` | +| `NOTIF_OPS` | `STREAM.NOTIF_OPS` | +| `CHAT` | `STREAM.CHAT` | +| `CHAT_OPS` | `STREAM.CHAT_OPS` | -</details> --- -### **Fetch Group Info** +### **Fetch Inbox Or Spam notifications** + +```tsx +// lists feeds +const aliceInfo = await userAlice.notification.list(); -```typescript -// Fetch Group Info -const fetchGroupInfo = await userAlice.chat.group.info(groupChatId); ``` -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ------------ | -| `chatId` | `string` | - | Group ChatId | +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| spam | INBOX or SPAM | INBOX | A string representing the type of feed to retrieve. | +| options* | object | - | An object containing additional options for filtering and pagination. | +| options.account* | string | - | Account in full CAIP | +| options.channels* | [string] | - | An array of channels to filter feeds by. | +| options.page* | number | - | A number representing the page of results to retrieve. | +| options.limit* | number | - | A number representing the maximum number of feeds to retrieve per page. | +| options.raw* | boolean | - | A boolean indicating whether to retrieve raw feed data. | + +\* - Optional <details> + <summary><b>Expected response (Fetching user notifications)</b></summary> - <summary><b>Expected response</b></summary> ```typescript -{ - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null +// PushAPI.user.getFeeds | Response - 200 OK +[ + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-32: Add Euler staking PYT wrappers for AA tranche to IdleDAI\n' + + '[timestamp:1676570405.922][timestamp: 1676570405]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '3401597', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null + secret: '', + }, + { + cta: '', + title: '', + message: 'hi socket', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '2491520', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hi socket', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'hiii', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '2490919', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hiii', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'Hey -testing', + icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + url: 'https://gnosis.io', + sid: '2429211', + app: 'Gnosis', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'Hey -testing', title: 'Gnosis - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'Hey', + icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + url: 'https://gnosis.io', + sid: '2429210', + app: 'Gnosis', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'Hey', title: 'Gnosis - ' }, + secret: '', + }, + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-31: Add AA Euler staking PYT wrappers to IdleUSDT, IdleUSDC and IdleWETH. Gauges rate to 0. Extend LM. \n' + + '[timestamp:1674583206.258][timestamp: 1674583206]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '1784234', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'create' -} + secret: '', + }, + { + cta: '', + title: '', + message: 'hi 2023', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '1132231', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hi 2023', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: '', + title: '', + message: 'hi', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicahk2k5jcprepvqxl7xvh5ia4wyruikvpvcrel2rt7tsuefc7ktu/bafkreihjprcvuf2er5etxh7hsvslxzbntum5fqournkrsrtvhvppwx7jqy', + url: 'https://www.google.com/', + sid: '1132230', + app: 'AKP Test Channel', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { body: 'hi', title: 'AKP Test Channel - ' }, + secret: '', + }, + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-30: Remove idleDAI wrapper for cpFOL-USDC (DAI) senior. Same for idleUSDC with cpWIN-USDC. Remove idleRAI, idleSUSD, idleTUSD and idleFEI from IdleController. Update voting delay in Governor \n' + + ' \n' + + '[timestamp:1672769747.911][timestamp: 1672769747]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '1080072', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', + }, + secret: '', + }, + { + cta: 'https://idle.finance/#/governance/proposals', + title: 'New Proposal', + message: + '[d:Proposer] : 0xe8eA8bAE250028a8709A3841E0Ae1a44820d677b\n' + + '\n' + + '[d:Proposal] : IIP-29: Remove idleDAI wrapper for cpFOL-USDC (DAI) senior. Same for idleUSDC with cpWIN-USDC. Remove idleRAI, idleSUSD, idleTUSD and idleFEI from IdleController. Update voting delay in Governor \n' + + ' \n' + + '[timestamp:1671624005.155][timestamp: 1671624005]', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidgjepmup44yqmghcmmzp5aohj6yemjuwal3hozowp2mnxmtdjv5u/bafkreieqw4su7yuqf5ycow4ajpzjyimfl4umnnoe5fz2mq7ukrmqnesk2y', + url: 'https://idle.finance/', + sid: '935285', + app: 'Idle Finance', + image: '', + blockchain: 'ETH_TEST_GOERLI', + notification: { + body: 'New Proposal On Idle Finance', + title: 'Idle Finance - New Proposal', + }, + secret: '', + }, +]; ``` -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | - </details> --- -### **Fetch Group Permissions** - -```typescript -// Fetch Group Permissions -const fetchGroupPermissions = await userAlice.chat.group.permissions( - groupChatId -); -``` +### **Fetch user subscriptions** -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ------------ | -| `chatId` | `string` | - | Group ChatId | - -<details> - - <summary><b>Expected response</b></summary> +```tsx +// fetches list of channels to which the user is subscribed +const subscriptions = await userAlice.notification.subscriptions(); -```typescript -{ - entry: true, - chat: true, - rules: { entry: { conditions: [] }, chat: { conditions: [] } } -} ``` -| Param | Type | Remarks | -| ------- | --------- | ----------------------------------------------------- | -| `entry` | `boolean` | Refers if the Profile has access to enter the group | -| `chat` | `boolean` | Refers if the Profile has access to chat in the group | -| `rules` | `object` | Moderation rules of the group | - -</details> - ---- - -### **Update Group** - -```typescript -// Update Group Info -const createdGroup = await userAlice.chat.group.create(groupChatId, { - description: newGroupDescription, - image: newGroupImage, -}); -``` +**Parameters:** -| Param | Type | Default | Remarks | -| ------------------------ | ------------------ | ------- | ------------------------------------------ | -| `chatId` | `string` | - | Unique identifier of the group. | -| `options` \* | `object` | - | Optional Configuration for updating group. | -| `options.name` \* | `string` | - | Updated Group Name | -| `options.description` \* | `string` | - | Updated Description | -| `options.image` \* | `string` | - | Updated Image | -| `options.scheduleAt` \* | `date` or `null` | - | Updated Start Schedule | -| `options.scheduleEnd` \* | `date` or `null` | - | Updated End Schedule | -| `options.status` \* | `string` or `null` | - | Updated group Status | -| `options.meta` \* | `object` or `null` | - | Updated Group Meta | -| `options.rules` \* | `object` | - | Updated Group Moderation Rules | +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options* | object | - | An object containing additional options for subscriptions. | +| options.account* | string | - | Account in CAIP . | +| options.page* | number | - | page of results to retrieve. | +| options.limit* | number | - | represents the maximum number of subscriptions to retrieve per page. | \* - Optional <details> - - <summary><b>Expected response</b></summary> + <summary><b>Expected response (Fetching user opted in channels / subscriptions)</b></summary> ```typescript -{ - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'update' -} +// PushAPI.user.getSubscriptions | Response - 200 OK +[ + { channel: '0x0000000000000000000000000000000000000000',user_settings: null }, + { channel: '0xa3B6712fB922cdbbdce9AB22571e75d0d81B3b00',user_settings: '[{"type": 1, "user": false, "index": 1, "default": false, "description": "test1"}, {"type": 2, "user": 25, "index": 2, "default": 25, "enabled": 1, "lowerLimit": 23, "upperLimit": 35, "description": "test3"}, {"type": 2, "user": 64, "index": 3, "default": 56, "enabled": 1, "lowerLimit": 43, "upperLimit": 78, "description": "test5"}]' }, + { channel: '0xde3aEA26fDC3ADdC1dB32baf1a058Cf0878FEac1',user_settings: null }, + { channel: '0x69e666767Ba3a661369e1e2F572EdE7ADC926029',user_settings: null }, + { channel: '0x466AEEf0943C5F098dBcEf3c1eEC03322E1F97eD',user_settings: null }, + { channel: '0xcE98113b998380729B04596e3eA0255fbA138D34',user_settings: null }, + { channel: '0xa89523351BE1e2De64937AA9AF61Ae06eAd199C7',user_settings: null }, + { channel: '0x0a651cF7A9b60082fecdb5f30DB7914Fd7d2cf93',user_settings: null }, + { channel: '0x0b5E9fa12C4C1946fA2f14b7271cC60541508f23',user_settings: null }, + { channel: '0x2AEcb6DeE3652dA1dD6b54D5fd4f7D8F43DaEb78',user_settings: null }, + { channel: '0xcB6C7b2E340D50701d45d55507f19A5cE5d72330',user_settings: null }, + { channel: '0xB59Cdc85Cacd15097ecE4C77ed9D225014b4D56D',user_settings: null }, + { channel: '0xA5E269eec042Bf61183DEf9911D03359597494b7',user_settings: null }, + { channel: '0x6bf1ee9DE5D11Fa558c1FA8D8855E26C38Fa582A',user_settings: null }, + { channel: '0x72Ac64A3aE0ab60D725980b73Ef460ED9e742cc7',user_settings: null }, + { channel: '0xEc6CbD318CB7BA8a0fBbffF697681C0a4ADA0349',user_settings: null }, + { channel: '0xAb9415961F58eBD6d79029bC76F261Fa65a80D3D',user_settings: null }, + { channel: '0x08D77bD7500a07d791dD1323919C22e1FDb72224',user_settings: null }, + { channel: '0xa1016081D6Da53b4246178eD83922C55F7171e54',user_settings: null }, + { channel: '0x6A06014AC6BdE2906D194e63ec3b1B5B4c9C2Abb',user_settings: null }, + { channel: '0xf69389475E082f4BeFDb9dee4a1E9fe6cd29f6e7',user_settings: null }, + { channel: '0x9601f08b9EcB981D273B72e7f33964Cb98f977fe',user_settings: null }, + { channel: '0x47A2910432016CA9f62B20dCE09b89d357d0c3d7',user_settings: null }, + { channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924',user_settings: null }, + { channel: '0x14c0157f9eEA7AEe61ba2606E75716E210b4697a',user_settings: null }, + { channel: '0x025846389950A13292E63e4794C7D148FF57F995',user_settings: null }, + { channel: '0x2aecb6dee3652da1dd6b54d5fd4f7d8f43daeb77',user_settings: null }, + { channel: '0xD8634C39BBFd4033c0d3289C4515275102423681',user_settings: null }, + { channel: '0x19fB80f16EAFCfb5BBFa07451CC5694E8932EA52',user_settings: null }, + { channel: '0x94c3016ef3e503774630fC71F59B8Da9f7D470B7',user_settings: null }, +] ``` -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | - </details> --- -### **Add To Group** +### **Subscribe to a channel** + +```tsx +// subscribes to a channel +const subscribeStatus = await userAlice.notification.subscribe(channelInCAIP) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| channel | string | - | Channel/Alias address in CAIP format | +| options* | SubscribeUnsubscribeOptions | - | Optional configuration | +| options.onSuccess* | () => void | - | A callback function to execute when the subscription is successful. | +| options.onError* | (err: Error) => void | - | A callback function to execute when an error occurs during subscription. | + +\* - Optional + +<details> + <summary><b>Expected response (Opt in to channel)</b></summary> ```typescript -// Add Member To Group -const addMemberToGroup = await userAlice.chat.group.add(groupChatId, { - role : 'MEMBER' - accounts: [account1, account2] -}); +// PushAPI.channels.subscribe | Response - 204 +{ status: 204, message: 'successfully opted into channel' } -// Add Admin To Group -const addAdminToGroup = await userAlice.chat.group.add(groupChatId, { - role : 'ADMIN' - accounts: [account1, account2] -}); ``` -| Param | Type | Default | Remarks | -| ------------------ | ------------------- | ------- | ----------------------------------------------- | -| `chatId` | `string` | - | Unique identifier of the group. | -| `options` | `object` | - | Configuration for adding participants to group. | -| `options.role` | `ADMIN` or `MEMBER` | - | Role of added participant | -| `options.accounts` | `string[]` | - | Added participant addresses | +</details> + +--- + +### **Unsubscribe to a channel** + +```tsx +// unsubscribes to the channel +const unsubscribeStatus = await userAlice.notification.unsubscribe(channelInCAIP) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| channel | string | - | Channel/Alias address in CAIP format | +| options* | SubscribeUnsubscribeOptions | - | Optional configuration | +| options.onSuccess* | () => void | - | A callback function to execute when the unsubscription is successful. | +| options.onError* | (err: Error) => void | - | A callback function to execute when an error occurs during unsubscription. | + +\* - Optional <details> + <summary><b>Expected response (Opt out of a channel)</b></summary> - <summary><b>Expected response</b></summary> +```typescript +// PushAPI.channels.unsubscribe | Response - 204 +{ status: 204, message: 'successfully opted out channel' } +``` + +</details> + +--- + +### **Channel information** + +```tsx +// fetches information about the channel +const channelInfo = await userAlice.channel.info(pushChannelInCAIP) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| channel* | string | - | Channel address in CAIP format | + +\* - Optional + +<details> + <summary><b>Expected response (Fetching channel details)</b></summary> ```typescript +// PushAPI.channels.getChannel | Response - 200 OK { - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'update' + id: 39, + channel: '0xD8634C39BBFd4033c0d3289C4515275102423681', + ipfshash: 'bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + name: 'Gnosis', + info: 'Gnosis builds new market mechanisms for decentralized finance.\n', + url: 'https://gnosis.io', + icon: 'https://gateway.ipfs.io/ipfs/bafybeifvbiegzbgyoikdxe2rqhxf2uuvrqtfmllzy2ueidzyxnqkvkuizu/bafkreia26pvmuo2ugyub7boo2zxxj6dqhwqt3gcllpotmau3t7gsvy6vfq', + processed: 1, + attempts: 0, + alias_address: '0xD8634C39BBFd4033c0d3289C4515275102423681', + alias_verification_event: null, + is_alias_verified: 1, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-07T16:29:27.000Z', + blocked: 0, + counter: null, + subgraph_details: null } ``` - -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | - </details> --- -### **Remove From Group** +### **Search Channels** -```typescript -// Remove Members To Group -const addMemberToGroup = await userAlice.chat.group.remove(groupChatId, { - role : 'MEMBER' - accounts: [account1, account2] // these accounts should be a part of group -}); +```tsx +// returns channel matching the query +const searchResult = await userAlice.channel.search("push") -// Remove Admin To Group -const addAdminToGroup = await userAlice.chat.group.remove(groupChatId, { - role : 'ADMIN' - accounts: [account1, account2] // // these accounts should be a part of group -}); ``` -| Param | Type | Default | Remarks | -| ------------------ | ------------------- | ------- | ----------------------------------------------- | -| `chatId` | `string` | - | Unique identifier of the group. | -| `options` | `object` | - | Configuration for adding participants to group. | -| `options.role` | `ADMIN` or `MEMBER` | - | Role of added participant | -| `options.accounts` | `string[]` | - | Added participant addresses | +**Parameters:** -<details> +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| query | string | - | The search query to find channels. | +| options* | ChannelSearchOptions | - | Configuration options for the search. | +| options.page* | number | - | The page of results to retrieve. Default is set to 1 | +| options.limit* | number | - | The maximum number of channels to retrieve per page. Default is set to 10 | - <summary><b>Expected response</b></summary> +\* - Optional + +<details> + <summary><b>Expected response (Searching for channel)</b></summary> ```typescript -{ - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'update' -} +// PushAPI.channels.search | Response - 200 OK +[ + { + id: 58, + channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924', + ipfshash: 'QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74', + name: 'Ethereum Push Notification Service', + info: 'The channel provides useful information, notifications, etc to all the users of the EPNS platform. While not recommended, you can unsubcribe if you want to.', + url: 'https://epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihwgapkthxi6udojr7soqetk5xx22bdy56uupivcwkriaiqzwlyiu/QmSbRT16JVF922yAB26YxWFD6DmGsnSHm8VBrGUQnXTS74', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 756, + }, + { + id: 817, + channel: '0xBA36124E8af635d9d32C4cC49802cacade133a5F', + ipfshash: 'QmUf7zuo4NXvkijhELfHAdmm8dQVY9VqesEs4xhobLZx4f', + name: 'push-ap-test', + info: 'testing push notifications', + url: 'https://www.google.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeigyk6kqiyn2dkburguqmnlkgvos4yld4hswcjcjnxbq6c5dqs7ih4/QmUf7zuo4NXvkijhELfHAdmm8dQVY9VqesEs4xhobLZx4f', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 57, + }, + { + id: 243, + channel: '0xC533ec1f876eA99088c85896F246C2ec8c7b05f9', + ipfshash: 'bafkreibc36t5tlygsa75w6nnkjmjieyzrohuscwzvohbj5tq6v6tgm2q4y', + name: 'EPNS PUSH Governance', + info: 'Get notifications on new proposals, grants, and stay up to date on all things PUSH Governance.', + url: 'https://epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihluvteyktaz6u7it6etf7jglqckcym5h5hxoqcilen73pcrz2wkq/bafkreibc36t5tlygsa75w6nnkjmjieyzrohuscwzvohbj5tq6v6tgm2q4y', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 9, + }, + { + id: 923, + channel: '0x7F69eec6cC1F619Ea8d27323d4430BbA5b739354', + ipfshash: 'QmeBqut7zMg4NSLbyEbUeLn2g9UnUE9fKjiVhYvWwJ3vqu', + name: 'Polygon Ahmedabad <> PUSH', + info: "You'll get cool notifications and update here.", + url: 'https://polygon.technology/blog/polygons-web3-made-in-india-tour-starts-rolling-with-7-guild-events-web3-education-programs', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiaxryfpf2gzmpq7uvye2kv3slru4vvdela5onldzder3zbbt3hoom/QmeBqut7zMg4NSLbyEbUeLn2g9UnUE9fKjiVhYvWwJ3vqu', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 9, + }, + { + id: 274, + channel: '0x554d29160f779Adf0a4328597cD33Ea1Df4D9Ee9', + ipfshash: 'bafkreichmnqqcn6tfcv5lnbbluchr3tqgbhiu45qnq56p2razdhvgnblcy', + name: 'Push Governance', + info: 'Get notifications on new proposals, grants, and stay up to date on all updates regarding PUSH Governance', + url: 'https://epns.io/gov', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihkfdd4lch5vvcmziowi7dmuum2pouvk3st4v5rvfxo3etcoxh7oe/bafkreichmnqqcn6tfcv5lnbbluchr3tqgbhiu45qnq56p2razdhvgnblcy', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 5, + }, + { + id: 1242, + channel: '0x453552953C4e2732A38B93F7fB834e5AeF6F60f8', + ipfshash: 'QmU7PC7yjdPfXJTgYuuqqvvWbxTn1rE3z8iWZEcorK3VPM', + name: 'Test push notifications', + info: 'Test push notifications', + url: 'https://www.youtube.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiarff4fukkj7fvmjuav6xvqzg5pfzyj2jcytzcbb5tdgyfzjfakfa/QmU7PC7yjdPfXJTgYuuqqvvWbxTn1rE3z8iWZEcorK3VPM', + processed: 1, + attempts: 0, + alias_address: '0x453552953C4e2732A38B93F7fB834e5AeF6F60f8', + alias_verification_event: + '{"aliasAddress": "0x453552953C4e2732A38B93F7fB834e5AeF6F60f8", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 5, + }, + { + id: 210, + channel: '0x8DaFfe9d1b5aDB33F53aDDC183C6b91F9cb30bc7', + ipfshash: 'bafkreiac6g3iul2uk6r6h2x5rsthgoq2y6uw23n4gzkvstfn7rl5tjq3v4', + name: 'PUSH for EthDenver', + info: 'Get notifications about everything EPNS at ETHDenver.', + url: 'http://ethdenver.epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeia2emdjy63kap2yqig3h4qlsjuawdby777osyr4rls2nyno2qsv6u/bafkreiac6g3iul2uk6r6h2x5rsthgoq2y6uw23n4gzkvstfn7rl5tjq3v4', + processed: 1, + attempts: 1, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 809, + channel: '0x9dFe790B3baBCBD888dA7093017a0B7A68b99937', + ipfshash: 'QmbrQeT4FdvYRQDrDhVvZ9XMhs2TUNSA7UHc4M53vvNcKK', + name: 'Push-Graph Test', + info: 'This channel is to test subgraph notifications.', + url: 'https://push.org/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihniwj5eflkxah7feqdgjnfuoyeq5iw4ka7qze3h6hdxsydx3gx3e/QmbrQeT4FdvYRQDrDhVvZ9XMhs2TUNSA7UHc4M53vvNcKK', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-03T12:26:00.000Z', + blocked: 0, + counter: 18, + subgraph_details: '60+aiswaryawalter/push-graph-test', + subscriber_count: 4, + }, + { + id: 956, + channel: '0x85Cb63e3D8cEf31a421e59b6678bF0444Fa5d8BE', + ipfshash: 'QmUAgUYKteWdpcWkKmNtySGY5w7XkRpUYdYtqcSfEfXzLP', + name: 'Transfer PUSHNOTIFICATION', + info: 'Notification for Transfer', + url: 'https://push.org/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeidwsc4kws4fvzzsdj5e46re46qmwxmgidouhcfeel34xmhxbqbroe/QmUAgUYKteWdpcWkKmNtySGY5w7XkRpUYdYtqcSfEfXzLP', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 967, + channel: '0xa45bdc5B11ce6F0952401bE35156398d8c40Ce64', + ipfshash: 'QmPWEKaJsfVweeyWT5bCftXDnbDFMgqw3sVpTnKtd3fH5a', + name: 'Push Graph Notif', + info: 'Subgraph notification test', + url: 'https://push.org/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihlt5qyhs3g3ii5vrrhb4evcsltoa6bssb2qiuh3bamxx4ndorkr4/QmPWEKaJsfVweeyWT5bCftXDnbDFMgqw3sVpTnKtd3fH5a', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-03T12:26:00.000Z', + blocked: 0, + counter: 18, + subgraph_details: '60+aiswaryawalter/push-graph-test', + subscriber_count: 4, + }, + { + id: 1425, + channel: '0x49403ae592C82fc3f861cD0b9738f7524Fb1F38C', + ipfshash: 'QmZ1t5upH5zHxvzefWppVNfv7ciacrDq9VUL3SZJ7trnNz', + name: 'SuperPush', + info: 'Create, Update and Delete Superfluid streams seemlessly and get alerted to your device with Push Notifications for every actions.', + url: 'https://www.superfluid.finance/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeibfnawzeadz7d2exw2ncbytanzwjb3mdkx74whga5b5scz6mmuymu/QmZ1t5upH5zHxvzefWppVNfv7ciacrDq9VUL3SZJ7trnNz', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 0, + verified_status: 0, + timestamp: '2023-02-18T21:02:50.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 1659, + channel: '0x43097889162A9f2b7D85104f16aB7aB090056975', + ipfshash: 'QmQKuiR9nZw46pnrW16J7GZTsg3hteh93mWHcHV5Khrj24', + name: 'Push Protocol Demo', + info: 'A demo channel for testing out Push Protocol', + url: 'https://youtube.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiaadvr565fk5mkam4hlmnaxdb7lxemfcffzqd24berqxw6sf3efny/QmQKuiR9nZw46pnrW16J7GZTsg3hteh93mWHcHV5Khrj24', + processed: 1, + attempts: 1, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-02-20T04:40:04.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 4, + }, + { + id: 287, + channel: '0x72F569DE6d77B1D4C3810767865FC706A1C39915', + ipfshash: 'bafkreidlxu5pnjeamnriukkqskv4v6ndfz5nifb2adrqwsvqiypg4oq4yi', + name: 'Push for DevConnect', + info: 'Stay upto date on all the happenings at DevConnect', + url: 'https://devconnect.org/schedule', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicgoxqjc3trzthp4chvdwyfe2nqm5lfaumkyztvm6vh6anwzztuty/bafkreidlxu5pnjeamnriukkqskv4v6ndfz5nifb2adrqwsvqiypg4oq4yi', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 369, + channel: '0x2b107f1B57F2A381dc8c09F8786FA3bdb3c70b27', + ipfshash: 'bafkreicnfx2wfjlphaoe7d3vttegbomdoc55n43p2r7wzpg2zzu2zcelrq', + name: 'Dapp Push notifications', + info: 'A channel to test out dapp push notifications', + url: 'animepahe.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihwyx4s5pv7afk7hskcvtz4j5o7yqkdwtb3t6mqsueqer4lbk53wy/bafkreicnfx2wfjlphaoe7d3vttegbomdoc55n43p2r7wzpg2zzu2zcelrq', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 445, + channel: '0x24a8E20a63DC3149BD7Ee136632161cDb8857522', + ipfshash: 'bafkreigglf54mwxxxzfhbexbyqgolyry4wfxkxvmxo3xojt6765rgi2r34', + name: 'Push Token Alerter', + info: 'Push Token alerter', + url: 'https://epns.io/', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiaxnibay6ezfwmsytoiilcppa7piutbdzqzmm6vfcqi7wrmlx4qmm/bafkreigglf54mwxxxzfhbexbyqgolyry4wfxkxvmxo3xojt6765rgi2r34', + processed: 1, + attempts: 2, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 735, + channel: '0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F', + ipfshash: 'QmeMSv9UrL5znYJoLkJgKnivzaN67WnfCWB7donSx8AbXP', + name: 'Push x Polygon', + info: 'Push x Polygon Integration', + url: 'https://push.org', + icon: 'https://gateway.ipfs.io/ipfs/bafybeiejlm3hfthuprnxyqj4onxnm3gy2tuygubaaapgw2bdhuqhhqggq4/QmeMSv9UrL5znYJoLkJgKnivzaN67WnfCWB7donSx8AbXP', + processed: 1, + attempts: 0, + alias_address: '0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F', + alias_verification_event: + '{"aliasAddress": "0x76AF8b0ED41EEBda6Eb2aA7991e0564cCFD1eC1F", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 737, + channel: '0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742', + ipfshash: 'QmZ3VQ87hNLeda2bgmvwZhKDaMgEboDVgGqTYktJGVNggG', + name: 'SeaLightPush', + info: 'Decentralized Exchange', + url: 'Https://SealightSwap.org', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicn4gmyg5gq3u3eoo5lbkuo4pbstrhw6uu2u6lgx6yd43e6zgxyg4/QmZ3VQ87hNLeda2bgmvwZhKDaMgEboDVgGqTYktJGVNggG', + processed: 1, + attempts: 0, + alias_address: '0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742', + alias_verification_event: + '{"aliasAddress": "0x0fEdC054075d14CF941A5cC62d22EBE9ad5de742", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 929, + channel: '0x983d0aD6D9c8778889311bC0E45DE417E9D74a90', + ipfshash: 'QmcqBzru5FFJDvLk7SYGEFYhgz9bokU77DWL4Kzt3NEDEJ', + name: 'Push amplify', + info: 'This channel will be used to test Push amplify features, and UI changes.', + url: 'https://twitter.com/pranshu3196', + icon: 'https://gateway.ipfs.io/ipfs/bafybeihkrzovmnbscultfjfrnjqnsfqmrhrjuvnnokjwm35n7gcqy7xefi/QmcqBzru5FFJDvLk7SYGEFYhgz9bokU77DWL4Kzt3NEDEJ', + processed: 1, + attempts: 0, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 1039, + channel: '0xc092d5Aa8c23165484486F246C828e4980b6C707', + ipfshash: 'QmXc2CE1c9fR34HVmkwQNaHRUvt7YxtiUcJfpBSbKTyBzD', + name: 'testPushHack', + info: 'test', + url: 'https://iamzub.in', + icon: 'https://gateway.ipfs.io/ipfs/bafybeia6djth6wbxpkujkxuftbkeot6d6atnhtyfb5k3bn5metcyj2pk3q/QmXc2CE1c9fR34HVmkwQNaHRUvt7YxtiUcJfpBSbKTyBzD', + processed: 1, + attempts: 1, + alias_address: 'NULL', + alias_verification_event: null, + is_alias_verified: 0, + alias_blockchain_id: 'NULL', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, + { + id: 1241, + channel: '0x11EaB508c309595F14E363e6a8d434BEab91eEBC', + ipfshash: 'QmZm14LgHZB2hYHcENkJNhrrL11QRKDCpX3AeVmXEiy2Hq', + name: 'Test for push', + info: 'Test for push', + url: 'https://www.youtube.com', + icon: 'https://gateway.ipfs.io/ipfs/bafybeicnv3jv7ylfxqgb5cqyzzi4lumbjeqyimcljewqbexszjrqeqkn5m/QmZm14LgHZB2hYHcENkJNhrrL11QRKDCpX3AeVmXEiy2Hq', + processed: 1, + attempts: 0, + alias_address: '0x11EaB508c309595F14E363e6a8d434BEab91eEBC', + alias_verification_event: + '{"aliasAddress": "0x11EaB508c309595F14E363e6a8d434BEab91eEBC", "aliasBlockchainId": "80001"}', + is_alias_verified: 1, + alias_blockchain_id: '80001', + activation_status: 1, + verified_status: 0, + timestamp: '2023-01-03T16:38:31.000Z', + blocked: 0, + counter: null, + subgraph_details: null, + subscriber_count: 3, + }, +]; ``` -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | - </details> --- -### **Join Group** +### **Get Subscribers Of A Channel** + +```tsx +// fetches subscribers of a channel +const subscribersResult = await userAlice.channel.subscribers() -```typescript -const joinGroup = await userAlice.chat.group.join(groupChatId); ``` -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ------------------------------- | -| `chatId` | `string` | - | Unique identifier of the group. | +**Parameters:** -<details> +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options* | ChannelInfoOptions | - | Configuration options for retrieving subscribers. | +| options.channel* | string | - | Channel address in CAIP | - <summary><b>Expected response</b></summary> +\* - Optional + +<details> + <summary><b>Expected response (Get channel's subscribers list)</b></summary> ```typescript +// PushAPI.channels.getSubscribers | Response - 200 OK { - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'update' + "itemcount": 11, + "subscribers": [ + "0x1d4f52775344f9a32093af0ccd03a4fb6dac8e30", + "0x28d615edd8404f8ca1e0271a0b5a48171589921a", + "0x4352639b99689069f9b0b847eee349c3c1b0706c", + "0x50029e62540537045bcfd3d320483865344edb33", + "0x5ac9e6205eaca2bbba6ef716fd9aabd76326eeee", + "0x778d3206374f8ac265728e18e3fe2ae6b93e4ce4", + "0xa44f2994750cf774eab05751d90ade4dedabe7fe", + "0xbcfb7da1dcf40e8cfb331683bb7d6f4eba091b08", + "0xcf5dbf241fc65a5af56c95101ac4e9ec2c57d941", + "0xd8634c39bbfd4033c0d3289c4515275102423681" + ] } ``` -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | +</details> + +--- + +### **Send a notification** + +```tsx +// sends a notification +const sendNotifRes = await userAlice.channel.send(['*'], {notification: {title: 'test',body: 'test',},}) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| recipients | string[] | - | An array of recipient addresses. Possible values are: Broadcast -> [*], Targeted -> [0xA], Subset -> [0xA, 0xB] | +| options | NotificationOptions | - | Configuration options for sending notifications. | +| options.notification | INotification | - | An object containing the notification's title and body. (Mandatory) | +| options.payload* | IPayload | - | An object containing additional payload information for the notification. | +| options.payload.title* | string | - | The title for the notification. If not provided, it is taken from notification.title. | +| options.payload.body* | string | - | The body of the notification. If not provided, it is taken from notification.body. | +| options.payload.cta* | string | - | Call to action for the notification. | +| options.payload.embed | string | - | Media information like image/video links | +| options.payload.meta* | { domain?: string, type: string, data: string } | - | Metadata for the notification, including domain, type, and data. | +| options.config* | IConfig | - | An object containing configuration options for the notification. | +| options.config.expiry* | number | - | Expiry time for the notification in seconds | +| options.config.silent* | boolean | - | Indicates whether the notification is silent. | +| options.config.hidden* | boolean | - | Indicates whether the notification is hidden. | +| options.advanced* | IAdvance | - | An object containing advanced options for the notification. | +| options.advanced.graph* | { id: string, counter: number } | - | Advanced options related to the graph based notification. | +| options.advanced.ipfs* | string | - | IPFS information for the notification. | +| options.advanced.minimal* | string | - | Minimal Payload type notification. | +| options.advanced.chatid* | string | - | For chat based notification. | +| options.advanced.pgpPrivateKey* | string | - | PGP private key for chat based notification. | +| options.channel* | string | - | Channel address in CAIP. Mostly used when a delegator sends a notification on behalf of the channel | + +\* - Optional + +<details> + <summary><b>Expected response (Send Notification)</b></summary> + +```typescript +// PushAPI.payloads.sendNotification | Response - 204 OK +``` + +</details> + +--- + +### **Create a channel** + +```tsx +// creates a channel +const createChannelRes = await userAlice.channel.create({name: channelName, description: channelDescription, url: channelURL, icon: base64FormatImage, alias?: aliasAddressInCAIP}) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options | CreateChannelOptions | - | Configuration options for creating a channel. | +| options.name | string | - | The name of the channel. | +| options.description | string | - | A description of the channel. | +| options.icon | string (base64 encoded) | - | The channel's icon in base64 encoded string format. | +| options.url | string | - | The URL associated with the channel. | +| options.alias* | string | - | alias address in CAIP | +| options.progresshook* | () => void | - | (Optional) A callback function to execute when the channel creation progresses. | + +\* - Optional + +<details> + <summary><b>Expected response (Create Channel)</b></summary> + +```typescript + { transactionHash: "0x25b099ee5afa75283e5b31eda788e3de465cac8d1a9b44edf5645d675e11f38c" + } +``` </details> --- -### **Leave Group** +### **Update channel information** + +```tsx +// updates channel info +const updateChannelRes = await userAlice.channel.update({name: newChannelName, description: newChannelDescription, url: newChannelURL, icon: newBase64FormatImage, alias?: newAliasAddressInCAIP}) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options | - | - | Configuration options for creating a channel. | +| options.name | string | - | New name of the channel. | +| options.description | string | - | New description of the channel. | +| options.icon | string (base64 encoded) | - | The channel's new icon in base64 encoded string format. | +| options.url | string | - | New URL associated with the channel. | +| options.alias* | string | - | New alias address in CAIP | +| options.progresshook* | () => void | - | A callback function to execute when the channel updation progresses. | +| | | | | + +\* - Optional + +<details> + <summary><b>Expected response (Update Channel)</b></summary> ```typescript -// Leave Group -const leaveGrp = await userAlice.chat.group.leave(groupChatId); + { transactionHash: "0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32" + } ``` +</details> -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ------------------------------- | -| `chatId` | `string` | - | Unique identifier of the group. | +--- + +### **Verify a channel** + +```tsx +const verifyChannelRes = await userAlice.channel.verify(channelToBeVerified) + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| channelToBeVerified | string | - | Channel address in CAIP to be verified | <details> + <summary><b>Expected response (Verify Channel)</b></summary> - <summary><b>Expected response</b></summary> +```typescript + { transactionHash: "0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32" + } +``` +</details> + +--- + +### **Create channel Setting** + +```tsx +// creates channel settings +const createChannelSettingRes = userAlice.channel.settings([{ type: 0, default: 1, description: 'marketing' }, {type: 2, default: 10, description: 'loan liquidation threshold', data: {upper: 100, lower: 5, enabled: true, ticker: 5}}]) + +``` + +**Parameters:** + +| Property | Type | Default | Description | +| --- | --- | --- | --- | +| type | number | - | The type of notification setting. 1 for boolean type and 2 for slider type | +| default | number | - | The default value for the setting. | +| description | string | - | A description of the setting. | +| data.upper* | number | - | Valid for slider type only. The upper limit for the setting. | +| data.lower* | number | - | Valid for slider type only. The lower limit for the setting. | +| data.enabled* | boolean | - | Valid for slider type only. If the settting should be enabled by default. | +| data.ticker* | number | - | Valid for slider type only. Offset for slider values | + +<details> + <summary><b>Expected response (Create Channel Setting)</b></summary> ```typescript -{ - members: [ - { - wallet: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADeYpZfxgn1HoMUuWM42v8ZWfLPwglQYmzz5rY3PdPPoRFU\n' + - 'v0AyPjYKpmLh2ZNfXjPaS9GuMdpXaomYSEwsV02hXZOQelo9cLop0Fc2i+l7\n' + - '70rYhePuOuQ+XD/xYzhngAgNJ9rX96YnSodldb8uJfxYmgoF0E9Z2o2fgZGj\n' + - 'll2CPnOaLXZaBQlPS3x/461TmZ1n2ZePS/fwiC7taLz3PtyGtKaC0vo4isvI\n' + - 'yf04fkjudG0XIns5CWjdR2HeDC8BzSl8OVj8AQAc5uVU8Abk+ejWVr4zfoox\n' + - 'eaziDPgGdkckFiQ6Tdsg0tPwwOpSrCCtJocTmc/fWaBb0YlnyAAL88fJABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZBMYqhmfI2WQQMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAACxNQf/UrM/whR7vCs+\n' + - 'ez8Y8Hz4WqIuXtfMh4l2nKVv5UUuAfQkBxEY5j6Ga2+JgKU3neQ34x/v6fm9\n' + - 'CLcY38Tc4AWyEx8KC78J+xOs7RMfyNBeiaf8KdaFfQrP0nMmufE6TxkfV1Y5\n' + - 'LJZZ8350rZVtYJppWtlH+gbyUmMObyWDWbL3aWtqa3xjv0kLsf7TnugiFwzB\n' + - 'gHHtk8tlDSOxRt0VdNNd19+/zrBYNl07Ig24WD2ETaJiaqa651z24/6/MkGT\n' + - 'MBoQh+679tuWWcTrNi4jIA8jhSQ5BOgbAapl3qXk0m9/Aexpe2s6ISLXe8YJ\n' + - 'j4cObDLv/ZKKeLZYTq9lVCydLAQUbs7ATQRk7zWYAQgAmx36uefgUF4cCSYH\n' + - 'WMWAOTyc8Awo+hxn6FktOLU1+9hfGrX2jwGLOoOwjNgbYJbiSvRglAX2b57/\n' + - 'qkkltAg1ZYCLSUzfBUbbWYlJNBwpv7+52zHaLUZ3gmI5aE48ad+uzaadgpVT\n' + - 'VqLbhdgkN6jkemPTlfMehyS49AAbmqeKfo2U72tm9ZqT2cPVCASMjN/Ux2qG\n' + - '3W8HTo0KIVFSbkTthl1zAlwAFksp0q437+pxbdJIecJ9mO6N4OQMnv+hVBDc\n' + - 'WrPqBDJ0nas4JNgLxmLv0pheGg/TEfwS/p6xGRW5m08bj2l0cgqmEaM27jbi\n' + - 'DEpOykRWsDMhheEfI2zV/Qam8QARAQABwsB2BBgBCAAqBYJk7zWYCZBMYqhm\n' + - 'fI2WQQKbDBYhBC9DyzhpX3ACb/yTq0xiqGZ8jZZBAAAnBggA1gkIopr9HJFP\n' + - 'fO5SebcbowH4AG9M0qBqF4h1JIKbqvOnxLSsC5QmmzFcjS9ihyHBvzbRVGkC\n' + - 'zEHYpLRedQ2AmQQfsf/VOoZJEOlb7tTk4+SpYtsGte5X/yLT5Bkls7Rp8ubK\n' + - '/V99muj1nA/OkasllXQUSGEweVz6ejzJ0oMm3Vewmw8PelsdAnfS7Ud1MnXQ\n' + - 'h+O8TCR56F5gAMWxZmxFpZMZyUFOH6KM+vL7HJUBztUS2g0ELsHKy9ep2yhv\n' + - 'iABIwx/gEuPr0NDAH9x9XFKg5m3rO64KTY4BRWBISwmQ25dM1s1bwDPLi5XI\n' + - '6Daw1glFxpPRrxgQGlVLzJOu5b8swQ==\n' + - '=9hCc\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: true, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAzUlEQVR4AcXBsWlDMRiF0c8XTeAJPIAgoFbgQew1PIbXyKsyhUGtCqM6ZAJX6Z32fykM4hnuObv71++TYJRKlHtji1EqUe6NSJgJM2G2W74/nkzIvfHKKJUZwkyYCbOUe+Odcm/MEGbCTJil2/VMdLx8Eo1S2SL3RnS7nomEmTATZmm//BANKlHujS1GqUT7hRVhJsyEWWLSKJVXcm/MEGbCTJgl/sm9EY1SmTFKJcq9EY1SiYSZMBNm6XE6sHJhJffGOz1OByJhJsyE2R/3lDA4e9QQhAAAAABJRU5ErkJggg==' - } - ], - pendingMembers: [ - { - wallet: 'eip155:0x119bb8ad40B1f94e2b30ae5f59eeaEB67cD0Bd6C', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0x6e0C509d14EbF26A529bf6DC5CC9bee7F5b8DBa4', - publicKey: null, - isAdmin: false, - image: null - }, - { - wallet: 'eip155:0xE3FDD0527a9F8418f9a7D9e970452827FbE202FF', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvNZgBCADouo4S2kPqA//+I7nDAk15/LcJ2TGvDhOYuPNUNMiNGOb4\n' + - 'txusuKz6HOaG+K9hiUBpHjKrYEmCT2FEXxt8bfS3SpWb74RHSkWUNUkxk25y\n' + - 'gE5gaCKyAdcnOUyVLmobVFFYtH6naK9bULaUtkVik1P0iuEevWHxtTpsjbyH\n' + - 'bZtNpVTdprdLib4Wx6bb7VogsvjlvNJcVJ4sfPE0XgsQgAGIev7yJyU0DGzt\n' + - '/EbvFX4sv51Kb1dX9ctBcvzVbs9+qT6LTivsrQp+TNHUN4zEeMhnWFFP5K1d\n' + - 'H445S6FWk53XvBudcOkFPtltU1MPCS6hmhevArBfYzy5eSlaKA/fH+kFABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO81mAQLCQcICZCrD2gy8Zu4awMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBKru9/u8wPcTeHibkasPaDLxm7hrAADa/Af+PbamVg/Ig2S2\n' + - 'HgIy4w5x7ulSk1/49+AmuiUMiVUwJSVBhROsyDbLET56w4+1TIMYZFJaczW3\n' + - '8tCvAOUSauzc52I3zwGmaCupBJokIWp7ncPh0B8TFYrgThgXV7sLf3xy4roy\n' + - 'y8oFz1Zla88krwtPe4Az7TF+WNdXoDsLNJ3GXRmNqs1GITmDqAXFWncl12NM\n' + - 'ajUKWIKc/Gi1oKfz22mabJTtWBimDpA12LaGK3GjEK5CiWXT3Tzlqn6R14EZ\n' + - '6ohpKZldSJiMPL0Bu9iT52iHOsw1wTZNC1L5lKhOCi3c+/fLRcJZt3hdCjqy\n' + - 'd/FSCa8/Ny/GrHBWoL49rSF4pDEA+s7ATQRk7zWYAQgAtNOoHCL7BCnjwp8O\n' + - 'htTxEI5r7Q/1zKKHiz6QKjjrGBYyR6gcmPM3JNEcvzY4OsCFnKBv2suOgrqH\n' + - '8kXJzfpIQ7u7uJs+O3p/cn86RMANiEnO8NbB/0scpfZ7Vg3eOfoiWYE4I/1o\n' + - 'FVDCyZ1YVqtbcmuW6D8i1djjeoUmkUDZyPo7Qs6hUsJeYA/Rfl8mH5sjy2cN\n' + - 'WXf8cEtOUqJtwERXt5aRB/nBZiC0bsP6hf0HtAoNA8/96TkqrcQpODW/RckD\n' + - 'fo4wkpEONHRH+LGX7GV0pwymHu42TUnULmED6BrMgMYG2sKpxMThxtAxRaiP\n' + - 'nZ3DKXr8GCjTYnbEZpoi2zKCOQARAQABwsB2BBgBCAAqBYJk7zWYCZCrD2gy\n' + - '8Zu4awKbDBYhBKru9/u8wPcTeHibkasPaDLxm7hrAADGyQgA5NMUkoyDTPZa\n' + - 'Znj1dB+17xBXCZ/u7pPQc1DukBefVke7/qYIicdnnEGIX3Zd7TckFRsDljR/\n' + - '3418Bne4WyL57fAF/GgYsegpJ9n1KT7oPxWzibIaYdj7R6bkDt5r61EDWC3N\n' + - 'VBbnZu9cO15TYkObJIiyNvwbQyd6Dm313b39GnEE8sM709TWsI6Es6rRZAfC\n' + - '+sI8ezYxqVUbP7sW3jJZYzdPOhZPHvFd5iJ2EfygEOuk5tb7AimfNwF/CNcB\n' + - 'weQGEU7feOSB9lXXA+Ag1duLM4B9bLbbHEQIPhKlBF1ED64e/W/5HNfoAkS4\n' + - 'qhzOD5XWs6xs45nnYqUbBFLG9Xk+Jg==\n' + - '=qtAv\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - isAdmin: false, - image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAw0lEQVR4AcXBsXECMRRF0csbdbAZBagHKlJMSOL90IUq2h5UABktLE6/HcizY4/fOafrcntzQB/BTKvBEcJMmAmz0keQtRpk67bzRQ1m1m0nu19E1keQCTNhJsxO1+X2JukjmHm+Ppg5Lw9mWg0yYSbMhFnhoPPy4C8JM2EmzArftBr8J2EmzIRZ6SPIWg2yPoKs1WCmjyBrNcj6CDJhJsyEWWk1OKKP4DdaDTJhJsyEWeEHrQbZuu3M3C/iCGEmzITZJ/s7LOkKUABjAAAAAElFTkSuQmCC' - } - ], - contractAddressERC20: null, - numberOfERC20: 0, - contractAddressNFT: null, - numberOfNFTTokens: 0, - verificationProof: 'pgp:-----BEGIN PGP SIGNATURE-----\n' + - '\n' + - 'wsBzBAEBCAAnBYJk7zWZCZBMYqhmfI2WQRYhBC9DyzhpX3ACb/yTq0xiqGZ8\n' + - 'jZZBAADwAwgAq/6WjtwRt1aPTLWwtSx80Ng/Wxf97dkpebMXSj9T7f5ia1rM\n' + - '8wqsuNUDMEMPB9LM34f6Q5pD994oeN2YT7z34u20mskiNphZdx/DNvu8w9UZ\n' + - 'rI3tyjfZULhARNVM34sSABnHtExbl4ZArhNDsT86ku0sZNjr9frn2mtgmlKN\n' + - 'nQdGcLJSxbci0hFg3nE5mYNpwZNs2S/2uk11WHKxzMhII6AdePE77BKPqedu\n' + - 'PiXDODO2dIvV8glLQoJPRPgc2ap+/xYIBUFljqHGPU/62VSLlHxBJv72p5s/\n' + - 'kOxiqD42TmpaaMtfudqgsZsGoYpZDHcMKYGNZs+9qVRHPRD+s0QhEA==\n' + - '=c6IF\n' + - '-----END PGP SIGNATURE-----\n', - groupImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - groupName: 'influential_maroon_gamefowl', - groupDescription: 'urgent_brown_butterfly', - isPublic: false, - groupCreator: 'eip155:0x140BE62b2177A975Bbef398DF8934b883E7d13f9', - chatId: '5f769c881ffe328117dea3d3acd0b97ce7f4c163e440f75a96be3e33f7d2a000', - meta: null, - scheduleAt: null, - scheduleEnd: null, - groupType: 'default', - status: null, - rules: {}, - eventType: 'update' -} + { transactionHash: "0xf5056d382f209b5a7bcbf08d69c80dd13079467ba38413da8ca065a45f901a32" + } ``` +</details> -| Parameter | Type | Remarks | -| -------------------------- | --------------------- | -------------------------------------------------------------- | -| `members` | `Array<Object>` | An array containing member objects. | -| `members.wallet` | `string` | The wallet address of the member. | -| `members.publicKey` | `string` | The member's public PGP key (if available). | -| `members.isAdmin` | `boolean` | Indicates whether the member is an admin. | -| `members.image` | `string` | Image associated with the member. | -| `pendingMembers` | `Array<Object>` | An array containing pending member objects. | -| `pendingMembers.wallet` | `string` | The wallet address of the pending member. | -| `pendingMembers.publicKey` | `string` | The pending member's public PGP key (if available). | -| `pendingMembers.isAdmin` | `boolean` | Indicates whether the pending member is an admin. | -| `pendingMembers.image` | `string` | Image associated with the pending member. | -| `contractAddressERC20` | `string` or `null` | Contract address for ERC20 tokens (Used for tokenGating). | -| `numberOfERC20` | `number` | The number of ERC20 tokens associated. (Used for tokenGating). | -| `contractAddressNFT` | `string` or `null` | Contract address for NFT tokens (Used for tokenGating) | -| `numberOfNFTTokens` | `number` | The number of NFT tokens associated. (Used for tokenGating) | -| `verificationProof` | `string` | Verification proof associated with group data. | -| `groupImage` | `string` | Group's image. | -| `groupName` | `string` | The name of the group. | -| `groupDescription` | `string` | Description of the group. | -| `isPublic` | `boolean` | Indicates whether the group is public or private. | -| `groupCreator` | `string` | Push Profile DID of the group creator. | -| `chatId` | `string` | Unique chat ID associated with the group. | -| `meta` | `object` or `null` | Additional metadata (if available). | -| `scheduleAt` | `timestamp` or `null` | Scheduled start time (if available). | -| `scheduleEnd` | `timestamp` or `null` | Scheduled end time (if available). | -| `groupType` | `string` | Type of the group (default, spaces, live etc). | -| `status` | `string` or `null` | Status information ( active, expired etc) | -| `rules` | `Object` | Group-specific moderation rules | -| `eventType` | `string` | The type of event (create, update etc) | +| \* - Optional + +--- + +### **Get delegators information** +```tsx +// fetch delegate information +const delegatorsInfo = userAlice.channel.delegate.get() + +``` + +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options* | ChannelInfoOptions | - | Configuration options for retrieving delegator information. | +| options.channel* | string | - | channel address in CAIP | +| \* - Optional | | | | + +<details> + <summary><b>Expected response (Get Delegates)</b></summary> + +```typescript +[ + '0x69e666767Ba3a661369e1e2F572EdE7ADC926029', + '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924', + '0x7b9e036BD304fd1Bea0523dE718038bbe345521A', + '0xD8634C39BBFd4033c0d3289C4515275102423681' +] +``` </details> --- -### **Reject Group Joining Request** +### **Add delegator to a channel or alias** + +```tsx +// adds a delegate +const addDelegatorRes = userAlice.channel.delegate.add(delegatorAddressInCAIP) -```typescript -// Reject Group Request -await userAlice.chat.group.reject(groupChatId); ``` -| Param | Type | Default | Remarks | -| -------- | -------- | ------- | ------------------------------- | -| `chatId` | `string` | - | Unique identifier of the group. | +**Parameters:** ---- +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| delegate | string | - | delegator address in CAIP | +| Note: Support for contract interaction via viem is coming soon | | | | -### **Fetch Encryption Info** +<details> + <summary><b>Expected response (Add Delegate)</b></summary> ```typescript -// Fetch Encryption Info -const aliceEncryptionInfo = await userAlice.encryption.info(); + { transactionHash: "0xee8055ffb8ce35268900c64a57ae28fa5f7ab56879311bb467640c0e7af79d4a" + } ``` +</details> -<details> +--- - <summary><b>Expected response</b></summary> +### **Remove delegator from a channel or alias** + +```tsx +// removes a delegate +const removeDelegatorRes = userAlice.channel.delegate.remove(delegatorAddressInCAIP) -```typescript -{ - decryptedPgpPrivateKey: '-----BEGIN PGP PRIVATE KEY BLOCK-----\n' + - '\n' + - 'xcLYBGTvQKUBCACgsuLM540Bq39fAbLRGoaRZR5/lETkpQSArzP4+B+wxcQe\n' + - 'IItuLF9z1+OHilx/uAJ6yWH2En8QdlSBRMDCSwhLOXYnrB5dTvEM2nm+v59H\n' + - 'sIRkRUogXSIgTrcVG7Tt0JsrjBV2avOki1L4vzPvHEDUtlKcxdJ5914W2lSu\n' + - '05xPG+ALRsYFki1ga6bt6kT1+v7GV+862hOHY/FugohLKdIZOo6CeI0ddnHF\n' + - '9jL3pu4aTRn11VIphju3KQ2oCxF/6843OrA4X/GtVtsoRq00RBLuv61ZmRpr\n' + - 'qsOgEz009cDEWdUWs8wvf75TG/MfYM4g+9nSWflJGMSD3PfVHKTzOsYlABEB\n' + - 'AAEAB/0d/GNPwuFP73VsAAAi/qUfmlPPkJYuaBBoBslW6s3XCYAn8wCxhTwm\n' + - 'fKFrWEkcV/S2fr910Eu/gaURHggt+RxKFSXUD0z3MlTOhjHzgwQwt2Js53UG\n' + - 'hvpoNuf421uuiJ97x771gs2F5a2M1vjU5FvAlWji8hLtSVhYQVNN8BSZuhkK\n' + - 'Adq+/MsHmOvD6YkBW2xuAGo1ZVF4D8JUJDUWcjRJCMr0gJJv34c8f74EYW8b\n' + - 'LhrLGZgPRBkJemmN08sVwW5NLlPwjHTrvZOcb9RQ/N3liBwamk13dIEMNil1\n' + - 'GjGI6txtd04SXN0nTq2e+v+n8jk3HgwM3ypTAbaO+XQSBWyhBAC/mIv9OK7t\n' + - 'RoNA42+nJU+SYLEFFDew6x0b6Yg8k44gSiWiYadRWpDRP/essz641W1Ksn0a\n' + - '02kx+m55tT6uQFFwly24FOaFexhfvhbKtmA+sfJtvQVNebgH/2EJn9QSti/y\n' + - 'rGBStwDs48Psb2ZtcNNwhYajTACLioEF/vgx7FhKbQQA1reKmY5TefRFEK0b\n' + - 'lBqkDyYZoLKxEAoXQ6IwrVbIdO2kvPVDjfAy1CqpCnDhzXdXYmHA3HHOPJgr\n' + - 'PkLc8r0MeZR7ZI67JSSFoP2ixlxJjI06vXjQVvzrCigSJfL24LaBXBjQtd8t\n' + - 'X+g4KpM+a5iGrE1dQ/dgCt/G97Ra2v7Ql5kD/01W5Q+NqXxb++YrTJOXaNhp\n' + - 'yfSWYqtf62/xMoRBY8n/jtmyVD88i61aoqRsTDy+6Ugoi9QkrzhL7PSgn6Gl\n' + - 'yy5whksUFHFIcXDGF0HtPLIuEUJ7V3tC9yZ8Q630o3Dirf1+tP6+aLoMLwb2\n' + - '5O+SZFQk4cAVvW4aKbyGPdhlDvYxPkPNAMLAigQQAQgAPgWCZO9ApQQLCQcI\n' + - 'CZD+BWKBkBMI0AMVCAoEFgACAQIZAQKbAwIeARYhBEXCtUQEMuKbuZLzrv4F\n' + - 'YoGQEwjQAAC0VAf/VNnQ5xfPHhm6JfZ+cH2lUfy65pZ+5GqXHanB9RcxZPHe\n' + - '9hzr0l1IJk4o48HUrIcwJhpBfXUsd9oLC81Un1io0uX37hE3in+ND4j11ZiR\n' + - 'e8kQakH67/R7XKUaD3JTfXTshVpWhVTa1mjBZZcxOzr8ZxhnuaSQ7888t5cF\n' + - '0zBuOo6YPmqiNVudlXlhXuiAVqp+xK5yamqxW9drz767aXUAvE9GChE4+P0i\n' + - 'a1wwvvA2wkZTE2+rJKvAWA8iit4TeOTTDJoja0zc2yKxytdeOy6PWr6lGjjb\n' + - 'zJEq9uqs1tx8znRosDkb+Gw26CHdUo2uVUDGkcesqxNUv+C/4R9eubBVYMfC\n' + - '2ARk70ClAQgA38Hi0a1rqZAPdBaUnlqY4x4pIi2KyFPQ7TmW3Y/V1NgEm9Y8\n' + - 'w3bx3TF8O8uDETn6U5ASUa2DG4gppcZrDqFsChnxhHOdJhEgh3X8LeyzuCHn\n' + - 'qWQPbo2iCt3ve0fRsK/f0ZPABgCqlgTGkeVi7KppUqB1FtkRMfh0Eqr3fLC9\n' + - 'pNRLtlnQT793rfavvXavK+0eeukZVPYbALuJq2tX0IBwr9+/6YEzSi7yo/1P\n' + - 'pRZSRSM9KQwk/R2ohS2FAytUpTRp/4OFIJqv93PxS7MlHVfe/lhc9fXeTvH2\n' + - 'sMQCfMsp16wP7Em+AjT5elJgXv3VrQ4whrr5yGfTvO9uQVoV7LKoWQARAQAB\n' + - 'AAf7BXspAJiiTGQnYsE6WQIwYFDg8lHCBmv6MFNysQD43JbBjyUxdhrL7C6O\n' + - 'A+N1dZaxXXpoHnjU/zfHyGQqw3AcFsfBqSxRV0lAXh0bZS8ZDGvFMlqtf5hn\n' + - '1aMP3pnY5r56Kba4M5Vw2E2r5Q9Ey/YVMCVW1O1SjOIwirQGLbdhH+BZMvcf\n' + - 'iAJ2fbQ919cX3CuATJnMs1/4Q+7dzPcksE1SON6eGeixrzXAr1y/Ls04wx9/\n' + - 'DXsXyPunzNDVdZPttEbpNcWv3gZ9MHpYIYbC3kbuopC7ICvW4pkSGkl+uiV8\n' + - 'iqoi+AxjgCvXSq+eVI11sZJ+Rjqi7M9yW5qjxzw2Wy25sQQA6Jm1+nXwo0UX\n' + - 'NagosTXSf++9CDraFdbbpz2HUX8B6Ls8HwTMQ7q/EZRqmjKqeT/BxVQVp+O6\n' + - 'WNMtpnGMUQrbDI6Tcu6C3kVhZg/R9dWpRigsOHnsySrI74nYh9DBISAkabCf\n' + - 'cqir7V7treB5vcIaS80ys1vFHgtuLtTgFisCfpEEAPZEb0rbQ5PR5yTBvE80\n' + - '0MW3OnNDqZ8905GHJ6IGJVOuQuDQfMoZ+06757IwrWrQ6mZk5WIyiHD31+tr\n' + - 'd58MP351/0wv1/WUkPEcwuxWuTIK1kKtwQkcl75wZbnqvAGOigAFlvOTNPnD\n' + - 'qZVODWmod1Yg0dLIB3HF/xV29nx5ngFJA/9ifa68aMeoZqd3CePMS3zUwyLy\n' + - '6ZZ2cnUuBLjf87Fl9Rl+OLPMryEwA24I6ybcaa01ZsUgG2SZIwkKAovEhgmJ\n' + - 'll5mXY9GNpULHj9fr2KyLkweFnvyTwIpv0VlT7WzEthebIM0hC0eSJyNmu2C\n' + - '/SQTKvYUIcwP3v1RMFsCNPV1dTy+wsB2BBgBCAAqBYJk70ClCZD+BWKBkBMI\n' + - '0AKbDBYhBEXCtUQEMuKbuZLzrv4FYoGQEwjQAABMkAf/UKvQHe+oYH/hU0/p\n' + - '7OXUMCKIzSHD9c7lrb2nnP4CGyxF+FoZbQ9qnMVuT6FX6zPyZgDtOjp8Grvc\n' + - 'ACBibxwujfnNdKBdA1r0XQGf2ht3BWYpgn9jGYw58bf3yaxr6/Dg1D7FzgbN\n' + - 'FkaarU8C4fEAhiAHY4SpMUzqej/QfrwvasjyqPnbD+vCqyTivNmpTb6LYzXP\n' + - 'BtXQW0A1B6EhmFwftGyNxIG1wEO+tWE4v4XLCyscAz8ZBMBPdfaRe26lnr6C\n' + - 'UnTUwL+VecX2uIVRE9w9FhXuKeaPoDzPWnu0SZ6WCUV3DxQwMoUB/3vJ8sRK\n' + - 'l2L+h0L32V6yjL0asut2G+qfvw==\n' + - '=o527\n' + - '-----END PGP PRIVATE KEY BLOCK-----\n', - pgpPublicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTvQKUBCACgsuLM540Bq39fAbLRGoaRZR5/lETkpQSArzP4+B+wxcQe\n' + - 'IItuLF9z1+OHilx/uAJ6yWH2En8QdlSBRMDCSwhLOXYnrB5dTvEM2nm+v59H\n' + - 'sIRkRUogXSIgTrcVG7Tt0JsrjBV2avOki1L4vzPvHEDUtlKcxdJ5914W2lSu\n' + - '05xPG+ALRsYFki1ga6bt6kT1+v7GV+862hOHY/FugohLKdIZOo6CeI0ddnHF\n' + - '9jL3pu4aTRn11VIphju3KQ2oCxF/6843OrA4X/GtVtsoRq00RBLuv61ZmRpr\n' + - 'qsOgEz009cDEWdUWs8wvf75TG/MfYM4g+9nSWflJGMSD3PfVHKTzOsYlABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO9ApQQLCQcICZD+BWKBkBMI0AMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBEXCtUQEMuKbuZLzrv4FYoGQEwjQAAC0VAf/VNnQ5xfPHhm6\n' + - 'JfZ+cH2lUfy65pZ+5GqXHanB9RcxZPHe9hzr0l1IJk4o48HUrIcwJhpBfXUs\n' + - 'd9oLC81Un1io0uX37hE3in+ND4j11ZiRe8kQakH67/R7XKUaD3JTfXTshVpW\n' + - 'hVTa1mjBZZcxOzr8ZxhnuaSQ7888t5cF0zBuOo6YPmqiNVudlXlhXuiAVqp+\n' + - 'xK5yamqxW9drz767aXUAvE9GChE4+P0ia1wwvvA2wkZTE2+rJKvAWA8iit4T\n' + - 'eOTTDJoja0zc2yKxytdeOy6PWr6lGjjbzJEq9uqs1tx8znRosDkb+Gw26CHd\n' + - 'Uo2uVUDGkcesqxNUv+C/4R9eubBVYM7ATQRk70ClAQgA38Hi0a1rqZAPdBaU\n' + - 'nlqY4x4pIi2KyFPQ7TmW3Y/V1NgEm9Y8w3bx3TF8O8uDETn6U5ASUa2DG4gp\n' + - 'pcZrDqFsChnxhHOdJhEgh3X8LeyzuCHnqWQPbo2iCt3ve0fRsK/f0ZPABgCq\n' + - 'lgTGkeVi7KppUqB1FtkRMfh0Eqr3fLC9pNRLtlnQT793rfavvXavK+0eeukZ\n' + - 'VPYbALuJq2tX0IBwr9+/6YEzSi7yo/1PpRZSRSM9KQwk/R2ohS2FAytUpTRp\n' + - '/4OFIJqv93PxS7MlHVfe/lhc9fXeTvH2sMQCfMsp16wP7Em+AjT5elJgXv3V\n' + - 'rQ4whrr5yGfTvO9uQVoV7LKoWQARAQABwsB2BBgBCAAqBYJk70ClCZD+BWKB\n' + - 'kBMI0AKbDBYhBEXCtUQEMuKbuZLzrv4FYoGQEwjQAABMkAf/UKvQHe+oYH/h\n' + - 'U0/p7OXUMCKIzSHD9c7lrb2nnP4CGyxF+FoZbQ9qnMVuT6FX6zPyZgDtOjp8\n' + - 'GrvcACBibxwujfnNdKBdA1r0XQGf2ht3BWYpgn9jGYw58bf3yaxr6/Dg1D7F\n' + - 'zgbNFkaarU8C4fEAhiAHY4SpMUzqej/QfrwvasjyqPnbD+vCqyTivNmpTb6L\n' + - 'YzXPBtXQW0A1B6EhmFwftGyNxIG1wEO+tWE4v4XLCyscAz8ZBMBPdfaRe26l\n' + - 'nr6CUnTUwL+VecX2uIVRE9w9FhXuKeaPoDzPWnu0SZ6WCUV3DxQwMoUB/3vJ\n' + - '8sRKl2L+h0L32V6yjL0asut2G+qfvw==\n' + - '=4XKH\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n' -} ``` -| Param | Type | Remarks | -| ------------------------ | ----------------------- | ------------------------------ | -| `decryptedPgpPrivateKey` | `string` | Push Profile's PGP Private key | -| `pgpPublicKey` | `string` | Push Profile's PGP Public key | -| `decryptedPassword` | `string` or `undefined` | Push Profile's Password | +**Parameters:** + +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| delegate | string | - | delegator address in CAIP | +| Note: Support for contract interaction via viem is coming soon | | | | + +<details> + <summary><b>Expected response (Remove Delegate)</b></summary> +```typescript + { transactionHash: "0xee8055ffb8ce35268900c64a57ae28fa5f7ab56879311bb467640c0e7af79d4a" + } +``` </details> --- -### **Update Encryption** +### **Alias Information** -```typescript -// Update keys encryption -const aliceUpdateEncryption = await userAlice.encryption.update( - ENCRYPTION_VERSION.PGP_V3 -); -``` +```tsx +// fetch alias info +const aliasInfo = userAlice.channel.alias.info({alias: '0xABC', aliasChain:'POLYGON'}) -| Param | Type | Default | Remarks | -| ------------------------ | --------------------------------------- | ------- | ----------------------------------------------------- | -| `updatedEncryptionType` | `ENCRYPTION_TYPE` | - | New Encryption Scheme to which keys are to be updated | -| `options` \* | `object` | - | Optional Configuration for updating encryption | -| `options.versionMeta` \* | `{ NFTPGP_V1 ?: { password : string} }` | - | New Password ( In case of NFT Profile ) | +``` -\* - Optional +| Parameter | Type | Default | Description | +| --- | --- | --- | --- | +| options | AliasOptions | - | Configuration options for retrieving alias information. | +| options.alias | string | - | The alias address | +| options.aliasChain | ALIAS_CHAIN | - | The name of the alias chain, which can be 'POLYGON' or 'BSC' or 'OPTIMISM' or 'POLYGONZKEVM' | <details> - - <summary><b>Expected response</b></summary> + <summary><b>Expected response (Alias Info)</b></summary> ```typescript { - did: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', - wallets: 'eip155:0xEaC9c666570782E262f1E2a0b1d3BE4B95aFA7cd', - publicKey: '-----BEGIN PGP PUBLIC KEY BLOCK-----\n' + - '\n' + - 'xsBNBGTu6YUBCACa7JaMqfhAnD/9ynE5Rhi8KNQ1tfdQe0ay/9jXX2naZIA+\n' + - '6WCi1uNcB2TTLfMuzsEl4u/26LTgtkr51snRt2QKgEqi5dXqbRD76wiRLd4h\n' + - 'ktBb4WB28o+BWOHYYJQq8he+zu3mQWjKLb1e9DyS0cTzwPwWVKce9IsG3NOi\n' + - 'eM7O5Kg5cU3qHXR+frF25peCBrzNXH+xuuTJPsX85h9dSz/u6dWXhk2LsX3s\n' + - 'cmX5mFcFErnGvUBddDGZc11q+WzZAtENPCxQrNjpkMtzCj9UMwgsJdzBghZZ\n' + - 'ZouGTG2uhfmIj3/KHOdwx/KGpTgC1iMVOb78kw9LmaxL6fGy4x9uvvI3ABEB\n' + - 'AAHNAMLAigQQAQgAPgWCZO7phQQLCQcICZABDloJB8hpcgMVCAoEFgACAQIZ\n' + - 'AQKbAwIeARYhBMga3B8GDU79nd/0mAEOWgkHyGlyAAAbHAf/bJMPIyvNZNjO\n' + - 'JK2xA1hYpzIGdbi3jMego6GXrmet3qY50zMKDccB2Ot399y/nmWMVEyfKYaP\n' + - '7N+mJbeAqIZ8TAHtpw++k/h8/hXoxb9iPsQyWYossuG499XyHnk+KEd4g0Wf\n' + - 'mqPk/XJB3xLLgW820jOsRRbWLyYKJEdh1Q+GIM+D6oIJ9ZmyRPv25u6yCF2P\n' + - '2IQZErWeYD/LxqMDw+uHdRZJRiyFy/Y7A43clejN+p3my8oktXh2N4+tEl7i\n' + - 'Hwxc5z9AOffuEyUerm0Rjwdn8rG8po7AfuXwmTiW1Sdc9TdJtAK/n6e9EFHV\n' + - 'gHzArwyaydHHy80Wqa+UF591NkPi387ATQRk7umFAQgAs0ao+EFoKJirGHfI\n' + - '69vZg+eAAUUKG657BzNzTAF2r5Y+a61jdcCAL+DXBcfks+H0dqG36zjOZTCJ\n' + - 'NirABp5RRPFty2VvUtOyezuKX/MBVg3st3t/yE3SncVaWMblAv3iegviNNpH\n' + - 'cFKqpHoVBWDNdhFHNsKTjpJcq3BVohy2Dxh8Di8N/1+gEPxADvIuH9MQ8MJk\n' + - '6lB9XYXBmmqtlQ3sB916mvusUIl8Zxw1C76yY0PAXz055zJMiL1vwo5gKDiV\n' + - 'iKyzry3wq7upPGJyeTKu7uUMifTPhJtyYvon2TIik5DIgHpqKziirCrolA+s\n' + - '7LhnFbawqDKleEdyCcL5mFCzXQARAQABwsB2BBgBCAAqBYJk7umFCZABDloJ\n' + - 'B8hpcgKbDBYhBMga3B8GDU79nd/0mAEOWgkHyGlyAABIqQgAmK9ijEEvtWTm\n' + - '7/mhkuDEtfPfcMexfkaCcGL4SdZqVz/h+eIL8+4EbI9uq+YTzcjtX8FAEQta\n' + - 'KWFACNEOPmSy6Sb9bDoNZUVpDaZzNNtqIK9Brt4zjJLEsDfmkuW3S/SgIYBQ\n' + - 'yTkuNmmAf8dr7L4fG0JlxPyGaL1/w9UDAr7xdU7WcHuyPc0edDGeE7NwaGWp\n' + - 'uBipXFw8AkikV3fCTDuOi3uhkIzZ5zlGCshD7m0aDSABwr4hbFzLFBDSrsiW\n' + - 'GKhWGYgf5Vx8qzlwXYYnoW/rn3UXWpeTXjq46ZNaxjHJ4VxGMyn/tHZOEjDE\n' + - 'vHapLIAgGyw2b+s+zZSqsXaMkH8WOw==\n' + - '=gPzx\n' + - '-----END PGP PUBLIC KEY BLOCK-----\n', - encryptedPrivateKey: '{"ciphertext":"4f1243e1ffa76180f46ade2eb093867750c6bf72e8d6c71c7c0edca176c2f9fb32c603bb5e52d933730e0350292431b6e5287b8201f60ce9151b6a141bde98cdc3d9e5df8f84e00e5e4173bdf28b66e9590db10195fbd41ed241a65ab84fb5da251f613376bf78efe1af64613dd54fb05dced7cf8de0907d61489712ad42f06b5c775d97d15dee09b1c58cd79f596674e403353bc7e03297aa0d3fdaecac573c962409622ff8b1335b6fbb661bd2d5f5a076d9079f857849ba917662b40151041eca71385844160fc603c4d1beefbf71b26ac8968de52d6bb534ef6d6e2ea987170059d7d881dc684d28b5b2817804fba3b659e3ec0e802583e581b9f75d2f7e69e428cba91e62719e9ca6697588389db89b982370d23952120c0f972ab4b3a0da888d52b5055c60785d276152e43929df532bc7d5d68c6bc3cfdd1ca780df346113999a19d8e4a96c02f149d1ee4cde802277081ef339153872c00c9e9ddfe3ba8da8c68c0565752fea32258087e66aab37397a27b0228b5ed1aeb09a93b80778fd7f949409106c4cd82ff550aafb9d7bdce8727a76882f59ef2c54a137e51f04b6c27a0b1b92cd781dafb489a5e8203232669f5416454cc9cfe8c5b0fd8abc19d9ef16285a8da0aca2ed747adef7b49b8215790266d9c4791c250b0580e89c6429d10a1bcd45cf016a7ae30e1db948147d992722a7191e31852e6fd3c3679d868f34ebbe65f255be4b90dd64ceb52eaeee7d3356683b7fd511729493c887289ddb0f00c65ca2a95114f0e37d3b73d06333e2787c5fa6dd6f6c9e8334ff153dd63e30c81247efd497cf2c038843d8653edf23822eae07dd19d0be26a921673185bcf016533fdb59150ff46096419e6a6aeb1bd4293fc8146848d715d43afd04aa40f2b5ae9d058671677aad2413952a20b5214e18bbf3b4b033d936d673a0302967de3f74b05b74bc6c89f30ddeaab1bf6c567fcee355797b6cba17c3fcc8955bdf096e2dda2577b3374089d8c9d287552e5658c91e812bd0b8b63482c8de98fde216dd557eb34bafca2f8e73dc4582fa36332e8869f2717519921605915d8e1c75a37295e198ec0af75926d89a6832456304474a10c567334998226d9b6f709ebc216fb067d958e78a622040c91f46af202273d0b40307fb34cba5a6a57fbb196ac6e88c16d527b9bdb04b12fa7ed0bc771692712ccd146c41890b5caddbbb13b8ba77e632b2d7597256fb576ce87d2aff35a0e953b8227a5dcbf30f7d189ca7f77f6f8b2c4eb2752199a7a485ab52a6b65b6edd6cf65caaeb6f65544cc74c2fb3431fa484fb69adbda08d2402da953f20425832b6a2d712d56a5cc34095f25fb9524a478a71d387b7dea45b4bd41e79c61dceca332898dfeecf83999ed4fad892e2ede714b93f3969ad140f38bfa95d321ae5ef089cf0ce435d59f8b6611c0fd014c67ed38646f0771f1a74c1f950ee0900d883aca3ec4efbb2f7737e717007ae757d874573d4d70c9d7e38f8ff30a29b983036e684c4eaf35a7c03ed32a8e3fc62f0863c56830127a5f3c0e905a93e7466a4f43f0793cb6752b9be8d03d7be26170f694ecbb200f611bbf1dac4b6ec085deb8c3d8ee188d8c9c8c17ca720c0f0dee4d00e5866b5443b6af6e69ca64b8eb5a8f5fa1e1d27bfacbf1b0ae11241215358f5045b0d1a73d1b15dbd904709340c1e2b42a4ef78f76b8f901d6337849cff1052f06a8919255b596fb36d2fdf789fdf611813d20729c26d517dde6f11a3f6045ec5158652e128cf7c483a0fb8ab772cb5cdb56e42e6bf8c863f173307c3e053168e54e9e65bcacbb144413ff76d08a94929e6cdde2c5944246a4b344f3ca0ada3b403429750bdce76f04668b05ed79e9119f00901e7f7b4f1eea8a1b5b0186e3ed41277040a257601b0f3917db595f3f1808d92071a4e9521a251e9c5a66f2c8a57511f61b9fd88df77330aeb4bc15c043814b33610d60f6d0a13fd7977efaa1843913f6d3a79bc88020406c9979163684efe7b7ade9613221d06b52cd96abd31b77a707748d52e6e16c8c90821f29359b35307c10dafce5f35c0ff9802c23aef19f0a95b49a317cd6207002a5a9b822b4c056c4cbf9b27045dda8325d93060f358bb837f00954a6e281d1bdd1817a7cce8ed4a801f9164d32c52739c1ac650109868664be1fabab47c675222dc9ff9d75f9fb49531c832264aa5b55998675975f59e34829ce90b00092bd77e46328a6459d5c967d905b8e976611b839925ad742500231fa86cb5f7e6f39cb1e2e36b81c55269ea0f5fdcba5c8c0e38a899540d52be49c83efae5243998b926f029dc2980d4fdb1c125db409d015e0b36bc02272da1c688ee1f61d23cbde585064ab1e2164d0ca529774ec7797407ba5d988c58853e74a124a64dc24d0289b6a599354faf64790177c3032f5d660d7b76dfbf1c03388a7c75b2309c509c6a92144e124c8bd188274bc844e8f0aa7b5a06e79ad5776b5a62003b89aef194dcc03cd3c1b1f3ea541805cfc4e18aa159f9b5395185b573538c9bab16876dff91f365d16dcc56b339b01b86882ef8e52c51edd9c5b2f8a35713ed6eb43036e09f64f6e59ab417958faff974b6705400b341439fef4cba371c601927da7e0a8f23e1c6d3e070a19c2216da85f159d60303ab1321e479f4c371372845cef03daa7d2776c18face6cfa2ff9eed26f9f0a353a0f1c9a99b2556dccc1212fcb5c2078a3b0e58a7f3f7b3f346d624435ef94c95d40dc726d2e7400ae405e89473a934e7646124e34473dfe17f7f9cf481aa059ef422508ffe67f9b9276084973db0683269a046c1a0aafa7ab075b28008cbfb862b7e30c8b2afa1c2923d914b3d2469266e8e0182274a3d8d89642723820e61aa2d97a9370789ec4e89ebee05b6c0bef10778caf2a34c2d7622dde5fa64b012bea6205127c3c845229ef553f013b73823dc6631078fc628532e3e518bdc790ab8460078dedf0c5cb00492136813e2b91679bba82f3cf95169751933bee4358f84154014dbcc1de1a30613218039ebb2444429380fd283d3b60bd5d5b470e861f6ecc751c22aa467168512a0ef45755e6b59a7be591bd3b08fde874b166ccfbbedba10a0956d2d18cbda515341c2112d6094a746e9f562db6543e5bde2c4d4f7c06b7550400d66f7242a14f34cd8a7374372f0eea49a49b72909fc11ff81ea54a1e2c07225cdee856383a657b0f13c14b00ae3b7b2a32a22beaab8cfd18641dbfa82619fdcdddd3339e9423e71c487305e8aa932b694e94c37c7e418e4014c8bb264f47e8283e216eeeabf0fbdd2f5eb8d0ea979738d4f18b7bf72d7711f5d22653f217c7305314ec2c47a0ecbf1dc8f9bc1379ae38e2a04e736a1171b947609bb66f8d352ce57230d709f196953471c5504c7f9f40ed2f64bf3bd04bd57521a364ea03b5f0603cceec7851738d97c3fd73c16547d4d143b009a79832a1ed244937dce09edf2d5e32ae52ab0331c449325dce9e5e8ed1563c967a5f92031f4275e3179274ef3e0752ac01caf8a20aabb23d584d4d6607833f95cfc92832d936c37bb8b37222aa842f48944d06b37434c8dce5f19b450a7d1bd568672ef2c8eaa2afb7cff404b33377a61061f56b01849feb918521a7d63cfbe12466aedc7159c577f213f2c157586b8719164cd7108edfa9211287b43aadbad997bc62f8169eec4a6e02aeb535f670878e6af538b5281da04470d318f893102613977390a434e0557302a68ce42e532d350446d4d813b84c07b42bf22fbe4889096ec6303574c95040d8dcfed1b9bd26782c5033d7d1a491fece156cbc19a705204ed38a547e00a09b73bc7a702ef9c2e659171d1daab63958268148aba59766bc7a4ffb68c1ae047d1f0c5fb45fbacd07079f72af301c6aa00eebc0662c6792fc707d388b339d4f45afbf576bacf8730ec3e0f1e9dc0f9a6d58fd146b2293aed8d110da24336f9a4c01ae12c03ce214c6502f5fbc5224dd8b8b2e4edf2af16b811e5c8595fa76cafe34ba66199caaed48b5dfd5ae74a3e6b6d51a09c70afc30ebc0f40d51a15f1a8c2c41ec482eddf14bed3fd11a9e2aa4446268af25b49e429e2528d5df57797f6f3cd431eb5ded8f830c85cecde8012c31500ce9363903739a6759704fa87bfef984ed0285c8c0a5bf2f0985b1b511eb4145e4b27e2df6aa7b5c7a913b76b1ca869151b75c0717389b3d186f4e4637a5ceba3cef64809c3a06551a6a46be31af61c0ef78afb057f6cc625647dc04dcd74eb97f7aee0f5640e24b7662c799013efb83c80ec2851acda7c6328de789ae99ce296494225bd169e49c9a12dc7e281778f7fe275e72571cd5a3608733998d2f6b96c1d26c25223153fc5afc2f6e3d72f57fbcb2d087d718d3b6703b286f1e340c23cd3bc715797edf3ce6d5169bcf783ac9686233cc0358725143008b25bfbd329e1c30654e4b4c9461239d41ae77f706e64e5e60ce6de83becfd056f2678f17474ab9f4976b2d7d5d014d78f716d7d4edbf6ce4ed44ed677274d6b9b6e4bf4946dfd1ed8b821c81957b4bf5cd534ed6ca84dadd9d6380513dc6406b32dcd5c1bfa468a79e88a56656e71aed0c6675540e1617a31e1c122295427590e83b63e8da58a6c5c21a15703994bdc2b90d399b62679a4269224257f3ead5a2dd0980e6f5a45c5a9392929cc4743e106c7335136c9f8a3a29190462eef908eab02cda97dbcb71dff26b0ef4dae51de293b4cff0ebf37fce1391247c5ccf77dfb64974c4a1e6beeaf82041bb0d653e2e9b612f3442bba8480b86fd7b35514fc056d7429d5fb36199d4a6f632ea615d9acc961082d9d91aca416b57582bcd2f182f5f5be02b3f597c680b2e6b37ee4d133e51d077491cb536d6261808c42684d0912fd7bcc97dacdf32394e7b","salt":"da23dc7dbf23136dabc337a0caa170c0db7e4efec5f5c8a648dff9b7cd7df49f","nonce":"fe0e4ec3d40fb7de21a354bf","version":"eip191-aes256-gcm-hkdf-sha256","preKey":"b43efae4c92a35d9c0b5f6178cb8b8a6642c77d0a9281f61beb9f6e8f7b006a5"}', - verificationProof: 'eip191v2:0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', - msgSent: 0, - maxMsgPersisted: 1000, - profile: { - name: null, - desc: null, - picture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', - profileVerificationProof: null - }, - origin: null, - name: null, - about: null, - profilePicture: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAqElEQVR4AcXBsQ3CUBBEwcfKCfIPnbgxF+ACKIYct+cGDpEdpCeCS0Damcu2PN40gqQaiE6QVAPREWbCTJgJM2EmzITZxJcg+acgqQaiEmbCTJhNQVINRCdIOgPRCZJKmAkzYTYNRLWfT6pjnalu54vOsc5U+/mkOtaZSpgJM2E2BUknSKr7eqWXdIKkEmbCTJhdtuXxphEkvxiIjjATZsJMmAkzYSbMPjaMJNvaf06gAAAAAElFTkSuQmCC', - numMsg: 0, - allowedNumMsg: 1000, - encryptionType: 'eip191-aes256-gcm-hkdf-sha256', - signature: '0x97ca70a87ec658e0e488e8b9f71644ee23840d809803fcf5bdcd174c9f39cdeb27f6e3a8885fec5bede5f264b3996bc3fa019b0d52745a5573a972b7e79e321c1c', - sigType: 'eip191v2', - encryptedPassword: null, - nftOwner: null, - linkedListHash: null, - nfts: null + channel: '0x0A087Fb5CC25F156115c8193Ef8116b77B9421F7', + alias_address: '0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + is_alias_verified: 1, + blocked: 0, + activation_status: 1 } ``` +</details> -| Parameter | Type | Remarks | -| ------------------- | -------- | --------------------------------------------------------------- | -| did | `string` | user decentralized identity | -| wallets | `string` | all wallets associated to the did | -| publicKey | `string` | Public PGP key | -| encryptedPrivateKey | `string` | Encrypted PGP Private Key | -| verificationProof | `string` | Verification proof | -| msgSent | `number` | Number of messages sent | -| maxMsgPersisted | `number` | Maximum number of messages that can be persisted | -| profile | `object` | User profile information | -| origin | `string` | Origin information (source of the data) | -| name | `string` | Profile Name ( Deprecated ) | -| about | `string` | Profile Description ( Deprecated ) | -| profilePicture | `string` | Profile Picture ( Deprecated ) | -| numMsg | `number` | Number of messages sent ( Deprecated ) | -| allowedNumMsg | `number` | Maximum number of messages that can be persisted ( Deprecated ) | -| encryptionType | `string` | Type of encryption used | -| signature | `string` | Account signature ( Deprecated ) | -| sigType | `string` | Type of signature ( Dprecated ) | -| encryptedPassword | `null` | Encrypted user password ( Deprecated ) | -| nftOwner | `null` | Owner of NFT ( Deprecated ) | -| linkedListHash | `null` | Deprecated | -| nfts | `null` | Information about owned NFTs( Dprecated ) | +### **Stream Notifications** + +```tsx + // recevive stream of notification + userAlice.stream.on(STREAM.NOTIF, (data: any) => { + console.log(data) + }) +``` + +<details> + <summary><b>Expected response (Inbox)</b></summary> + +```typescript +{ + "event": "notification.inbox", + "origin": "other", + "timestamp": "2023-10-06T01:55:51.000Z", + "from": "0xfFA1aF9E558B68bBC09ad74058331c100C135280", + "to": [ + "eip155:0xffa1af9e558b68bbc09ad74058331c100c135280" + ], + "notifID": "1676", + "channel": { + "name": "Testing Goerli", + "icon": "https://gateway.ipfs.io/ipfs/bafybeifu3tisz7cntfnoolwe6tthi554b2cdl46jzcr5amo6swucyautzq/QmYZZnnEuTnzjkhhnRZWaHgYTeHsohLZEme9LomWRYQAZ5", + "url": "https://dev.push.org/" + }, + "meta": { + "type": "NOTIFICATION.BROADCAST" + }, + "message": { + "notification": { + "title": "Testing Goerli - notification TITLE:", + "body": "notification BODY" + }, + "payload": { + "title": "payload title", + "body": "sample msg body", + "cta": "", + "embed": "", + "meta": { + "domain": "push.org" + } + } + }, + "config": { + "expiry": null, + "silent": false, + "hidden": false + }, + "source": "ETH_TEST_GOERLI", + "raw": { + "verificationProof": "eip712v2:0xf2b50f07c7cdae4a493860554301dc017dd6f819f92db3aba534dffde210bfaa0f545818e919c42c3bb51181339af33ad83e3bc691ada7fcccdcbc7fb3b3abd91b::uid::feaa2d31-85ec-47d2-b38c-6f797f637de7" + } +} +``` </details> --- + +<details> + <summary><b>Expected response (Spam)</b></summary> + +```typescript +{ + "event": "notification.spam", + "origin": "other", + "timestamp": "2023-10-06T01:55:51.000Z", + "from": "0xfFA1aF9E558B68bBC09ad74058331c100C135280", + "to": [ + "eip155:0x1f1a304af17f22cac91eeca5f31a0f814d752377" + ], + "notifID": "1677", + "channel": { + "name": "Testing Goerli", + "icon": "https://gateway.ipfs.io/ipfs/bafybeifu3tisz7cntfnoolwe6tthi554b2cdl46jzcr5amo6swucyautzq/QmYZZnnEuTnzjkhhnRZWaHgYTeHsohLZEme9LomWRYQAZ5", + "url": "https://dev.push.org/" + }, + "meta": { + "type": "NOTIFICATION.TARGETTED" + }, + "message": { + "notification": { + "title": "Testing Goerli - notification TITLE:", + "body": "notification BODY" + }, + "payload": { + "title": "payload title", + "body": "sample msg body", + "cta": "", + "embed": "", + "meta": { + "domain": "push.org" + } + } + }, + "config": { + "expiry": null, + "silent": false, + "hidden": false + }, + "source": "ETH_TEST_GOERLI", + "raw": { + "verificationProof": "eip712v2:0x6b903f16d0ce87483643e1502e7416203cb7ecef0e947a497f0fb6fbe1c43c3511f2f602b757ab02c1be7daa07f3872ee14e4d05134f1ecb3d11fe58324422c01c::uid::6c0fad10-d1eb-4779-84d3-3a96bd96263f" + } +} +``` +</details> diff --git a/packages/restapi/package-lock.json b/packages/restapi/package-lock.json index a2cdeca0a..49c454e84 100644 --- a/packages/restapi/package-lock.json +++ b/packages/restapi/package-lock.json @@ -1,19 +1,24 @@ { "name": "@pushprotocol/restapi", - "version": "0.0.1-alpha.13", + "version": "1.4.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@pushprotocol/restapi", - "version": "0.0.1-alpha.13", + "version": "1.4.11", "dependencies": { + "@ambire/signature-validator": "^1.3.1", "@metamask/eth-sig-util": "^5.0.2", + "@pushprotocol/socket": "^0.5.2", "buffer": "^6.0.3", "crypto-js": "^4.1.1", "immer": "^10.0.2", + "joi": "^17.9.2", + "livepeer": "^2.5.8", "openpgp": "^5.5.0", - "simple-peer": "^9.11.1" + "simple-peer": "^9.11.1", + "video-stream-merger": "^4.0.1" }, "devDependencies": { "@types/chai": "^4.3.4", @@ -31,6 +36,16 @@ "ethers": "^5.6.8" } }, + "node_modules/@ambire/signature-validator": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ambire/signature-validator/-/signature-validator-1.3.1.tgz", + "integrity": "sha512-kR6Se3nhAGf1VMeun7V2Lml9KRXB5oz64vO2zGSg+dNaGq4BPDEjsNdr0PIKXZ8651sDlRCN7V9SzL5E2ddBYQ==", + "dependencies": { + "ethers": "^5.6.5", + "tap-spec": "^5.0.0", + "tape": "^5.5.3" + } + }, "node_modules/@chainsafe/as-sha256": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz", @@ -104,7 +119,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", @@ -131,7 +145,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -156,7 +169,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", @@ -179,7 +191,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -202,7 +213,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0" } @@ -221,7 +231,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/properties": "^5.7.0" @@ -241,7 +250,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", @@ -251,8 +259,7 @@ "node_modules/@ethersproject/bignumber/node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "peer": true + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, "node_modules/@ethersproject/bytes": { "version": "5.7.0", @@ -268,7 +275,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/logger": "^5.7.0" } @@ -287,7 +293,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bignumber": "^5.7.0" } @@ -306,7 +311,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-provider": "^5.7.0", @@ -334,7 +338,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", @@ -361,7 +364,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/basex": "^5.7.0", @@ -391,7 +393,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", @@ -422,7 +423,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "js-sha3": "0.8.0" @@ -441,8 +441,7 @@ "type": "individual", "url": "https://www.buymeacoffee.com/ricmoo" } - ], - "peer": true + ] }, "node_modules/@ethersproject/networks": { "version": "5.7.1", @@ -458,7 +457,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/logger": "^5.7.0" } @@ -477,7 +475,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/sha2": "^5.7.0" @@ -497,7 +494,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/logger": "^5.7.0" } @@ -516,7 +512,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", @@ -554,7 +549,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0" @@ -574,7 +568,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0" @@ -594,7 +587,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", @@ -615,7 +607,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", @@ -628,8 +619,7 @@ "node_modules/@ethersproject/signing-key/node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "peer": true + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, "node_modules/@ethersproject/solidity": { "version": "5.7.0", @@ -645,7 +635,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -669,7 +658,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", @@ -690,7 +678,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", @@ -717,7 +704,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/constants": "^5.7.0", @@ -738,7 +724,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", @@ -771,7 +756,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/base64": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -794,7 +778,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/hash": "^5.7.0", @@ -803,6 +786,19 @@ "@ethersproject/strings": "^5.7.0" } }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==" + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", @@ -828,6 +824,53 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@livepeer/core": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@livepeer/core/-/core-1.8.6.tgz", + "integrity": "sha512-VWMHaHMzNCr8YuC9hD87Ju+fwnpldEoe3y9CqOXrQPyyIgiAWfraZBA6Ard67f09X9UBGaaRcAMgMcCUs9HtKA==", + "dependencies": { + "cross-fetch": "^4.0.0", + "ms": "^3.0.0-canary.1", + "multiformats": "9.9.0", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + }, + "peerDependencies": { + "react": ">=17.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, + "node_modules/@livepeer/core/node_modules/ms": { + "version": "3.0.0-canary.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz", + "integrity": "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g==", + "engines": { + "node": ">=12.13" + } + }, + "node_modules/@ljharb/resumer": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@ljharb/resumer/-/resumer-0.0.1.tgz", + "integrity": "sha512-skQiAOrCfO7vRTq53cxznMpks7wS1va95UCidALlOVWqvBAzwPVErwizDwoMqNVMEn1mDq0utxZd02eIrvF1lw==", + "dependencies": { + "@ljharb/through": "^2.3.9" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/@metamask/eth-sig-util": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-5.0.2.tgz", @@ -866,6 +909,18 @@ } ] }, + "node_modules/@pushprotocol/socket": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@pushprotocol/socket/-/socket-0.5.2.tgz", + "integrity": "sha512-lVGMT3q8T5by6qwAhQ+zIeE/yv7oUC9eIlFux8M7WaKu/ArLBrrojD5REbr9QXXwpJIP3Q8GJUKyClZl4uGsJw==", + "dependencies": { + "socket.io-client": "^4.5.2", + "tslib": "^2.3.0" + }, + "peerDependencies": { + "ethers": "^5.6.8" + } + }, "node_modules/@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -908,6 +963,34 @@ "@scure/base": "~1.1.0" } }, + "node_modules/@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==" + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, + "node_modules/@stitches/core": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz", + "integrity": "sha512-Gfkvwk9o9kE9r9XNBmJRfV8zONvXThnm1tcuojL04Uy5uRyqg93DC83lDebl0rocZCfKSjUv+fWYtMQmEDJldg==" + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -990,8 +1073,7 @@ "node_modules/aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", - "peer": true + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, "node_modules/ansi-colors": { "version": "4.1.1", @@ -1051,6 +1133,55 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "dependencies": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.every": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.5.tgz", + "integrity": "sha512-FfMQJ+/joFGXpRCltbzV3znaP5QxIhLFySo0fEPn3GuoYlud9LhknMCIxdYKC2qsM/6VHoSp6YGwe3EZXrEcwQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -1071,11 +1202,21 @@ "node": "*" } }, + "node_modules/available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base64-js": { "version": "1.5.1", @@ -1099,8 +1240,7 @@ "node_modules/bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "peer": true + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, "node_modules/binary-extensions": { "version": "2.2.0", @@ -1120,7 +1260,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1141,8 +1280,7 @@ "node_modules/brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "peer": true + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" }, "node_modules/browser-stdout": { "version": "1.3.1", @@ -1173,6 +1311,28 @@ "ieee754": "^1.2.1" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha512-Zy8ZXMyxIT6RMTeY7OP/bDndfj6bwCan7SS98CEndS6deHwWPpseeHlwarNcBim+etXnF9HBc1non5JgDaJU1g==" + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -1325,11 +1485,34 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/combine-errors": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/combine-errors/-/combine-errors-3.0.3.tgz", + "integrity": "sha512-C8ikRNRMygCwaTx+Ek3Yr+OuZzgZjduCOfSQBjbM8V3MfgcjSTeto/GXP6PAwKvJz/v15b7GHZvx5rOlczFw/Q==", + "dependencies": { + "custom-error-instance": "2.1.1", + "lodash.uniqby": "4.5.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/core-js": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz", + "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "node_modules/create-require": { "version": "1.1.1", @@ -1337,6 +1520,14 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -1358,6 +1549,11 @@ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" }, + "node_modules/custom-error-instance": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz", + "integrity": "sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg==" + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1403,6 +1599,71 @@ "node": ">=6" } }, + "node_modules/deep-equal": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", + "integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==", + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.1", + "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-data-property": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", + "integrity": "sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==", + "dependencies": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/defined": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", + "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -1412,11 +1673,37 @@ "node": ">=0.3.1" } }, + "node_modules/dotignore": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", + "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", + "dependencies": { + "minimatch": "^3.0.4" + }, + "bin": { + "ignored": "bin/ignored" + } + }, + "node_modules/dotignore/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" + }, "node_modules/elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "peer": true, "dependencies": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -1442,11 +1729,151 @@ "once": "^1.4.0" } }, + "node_modules/engine.io-client": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz", + "integrity": "sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0", + "xmlhttprequest-ssl": "~2.0.0" + } + }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/err-code": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" }, + "node_modules/es-abstract": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", + "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "dependencies": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -1493,7 +1920,6 @@ "url": "https://www.buymeacoffee.com/ricmoo" } ], - "peer": true, "dependencies": { "@ethersproject/abi": "5.7.0", "@ethersproject/abstract-provider": "5.7.0", @@ -1558,6 +1984,26 @@ "node": ">=6" } }, + "node_modules/figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==", + "dependencies": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1595,11 +2041,18 @@ "flat": "cli.js" } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { "version": "2.3.2", @@ -1615,6 +2068,36 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-browser-rtc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz", @@ -1638,9 +2121,31 @@ "node": "*" } }, - "node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "node_modules/get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "dev": true, "dependencies": { @@ -1650,6 +2155,21 @@ "node": ">=6" } }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -1694,6 +2214,86 @@ "node": "*" } }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "dependencies": { + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-dynamic-import": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz", + "integrity": "sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1703,11 +2303,57 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "peer": true, "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -1722,11 +2368,15 @@ "he": "bin/he" } }, + "node_modules/hls.js": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.4.12.tgz", + "integrity": "sha512-1RBpx2VihibzE3WE9kGoVCtrhhDWTzydzElk/kyRbEOLnb1WIE+3ZabM/L8BqKFTCL3pUy4QzhXgD1Q6Igr1JA==" + }, "node_modules/hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "peer": true, "dependencies": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -1765,7 +2415,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -1776,6 +2425,19 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "dependencies": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/invert-kv": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", @@ -1785,6 +2447,45 @@ "node": ">=4" } }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1797,6 +2498,57 @@ "node": ">=8" } }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -1806,6 +2558,17 @@ "node": ">=0.10.0" } }, + "node_modules/is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==", + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -1836,6 +2599,25 @@ "npm": ">=3" } }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -1845,6 +2627,20 @@ "node": ">=0.12.0" } }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -1854,6 +2650,40 @@ "node": ">=8" } }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -1863,6 +2693,48 @@ "node": ">=0.10.0" } }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "dependencies": { + "which-typed-array": "^1.1.11" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", @@ -1875,16 +2747,74 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/joi": { + "version": "17.10.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.10.2.tgz", + "integrity": "sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA==", + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, + "node_modules/js-base64": { + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", + "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" + }, "node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "peer": true }, "node_modules/js-yaml": { @@ -1911,6 +2841,37 @@ "node": ">=6" } }, + "node_modules/livepeer": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/livepeer/-/livepeer-2.8.6.tgz", + "integrity": "sha512-8K2lRtpgZKbv6l6cGYYMJW9qpdRKkGUuy7R7xTLkS6NaRQzaeW08vubftmbMHil8v8GX/nDmodcW2vA4oIkP0w==", + "dependencies": { + "@livepeer/core": "^1.8.6", + "@stitches/core": "^1.2.8", + "core-js": "^3.31.1", + "cross-fetch": "^4.0.0", + "hls.js": "^1.4.9", + "ms": "^3.0.0-canary.1", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + }, + "peerDependencies": { + "react": ">=17.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + } + } + }, + "node_modules/livepeer/node_modules/ms": { + "version": "3.0.0-canary.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz", + "integrity": "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g==", + "engines": { + "node": ">=12.13" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -1926,15 +2887,74 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/lodash._baseiteratee": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash._baseiteratee/-/lodash._baseiteratee-4.7.0.tgz", + "integrity": "sha512-nqB9M+wITz0BX/Q2xg6fQ8mLkyfF7MU7eE+MNBNjTHFKeKaZAPEzEg+E8LWxKWf1DQVflNEn9N49yAuqKh2mWQ==", "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, + "lodash._stringtopath": "~4.8.0" + } + }, + "node_modules/lodash._basetostring": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz", + "integrity": "sha512-SwcRIbyxnN6CFEEK4K1y+zuApvWdpQdBHM/swxP962s8HIxPO3alBH5t3m/dl+f4CMUug6sJb7Pww8d13/9WSw==" + }, + "node_modules/lodash._baseuniq": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz", + "integrity": "sha512-Ja1YevpHZctlI5beLA7oc5KNDhGcPixFhcqSiORHNsp/1QTv7amAXzw+gu4YOvErqVlMVyIJGgtzeepCnnur0A==", + "dependencies": { + "lodash._createset": "~4.0.0", + "lodash._root": "~3.0.0" + } + }, + "node_modules/lodash._createset": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz", + "integrity": "sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA==" + }, + "node_modules/lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ==" + }, + "node_modules/lodash._stringtopath": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/lodash._stringtopath/-/lodash._stringtopath-4.8.0.tgz", + "integrity": "sha512-SXL66C731p0xPDC5LZg4wI5H+dJo/EO4KTqOMwLYCH3+FmmfAKJEZCm6ohGpI+T1xwsDsJCfL4OnhorllvlTPQ==", + "dependencies": { + "lodash._basetostring": "~4.12.0" + } + }, + "node_modules/lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==" + }, + "node_modules/lodash.uniqby": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.5.0.tgz", + "integrity": "sha512-IRt7cfTtHy6f1aRVA5n7kT8rgN3N1nH6MOWLcHfpWG2SH19E3JksLK38MktLxZDhlAjCP9jpIXkOnRXlu6oByQ==", + "dependencies": { + "lodash._baseiteratee": "~4.7.0", + "lodash._baseuniq": "~4.6.0" + } + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, "engines": { "node": ">=10" }, @@ -1942,6 +2962,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, "node_modules/loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -2000,8 +3032,7 @@ "node_modules/minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "peer": true + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, "node_modules/minimatch": { "version": "5.0.1", @@ -2024,6 +3055,14 @@ "balanced-match": "^1.0.0" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/mocha": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", @@ -2403,6 +3442,11 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + }, "node_modules/nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -2421,6 +3465,25 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2451,11 +3514,66 @@ "node": ">=0.10.0" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -2551,6 +3669,14 @@ "node": ">=4" } }, + "node_modules/parse-ms": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", + "integrity": "sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2564,7 +3690,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -2578,6 +3703,11 @@ "node": ">=4" } }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -2599,6 +3729,42 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/plur": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-1.0.0.tgz", + "integrity": "sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pretty-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-2.1.0.tgz", + "integrity": "sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==", + "dependencies": { + "is-finite": "^1.0.1", + "parse-ms": "^1.0.0", + "plur": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==" + }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -2609,6 +3775,11 @@ "once": "^1.3.1" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -2636,6 +3807,23 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/re-emitter": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/re-emitter/-/re-emitter-1.1.3.tgz", + "integrity": "sha512-bHJul9CWcocrS+w5e5QrKYXV9NkbSA9hxSEyhYuctwm6keY9NXR2Xt/4A0vbMP0QvuwyfEyb4bkowYXv1ziEbg==" + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -2661,6 +3849,30 @@ "node": ">=8.10.0" } }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -2676,6 +3888,52 @@ "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==", "dev": true }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "node_modules/resolve": { + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2695,6 +3953,19 @@ } ] }, + "node_modules/safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -2703,8 +3974,7 @@ "node_modules/scrypt-js": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", - "peer": true + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, "node_modules/semver": { "version": "5.7.1", @@ -2730,6 +4000,19 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, + "node_modules/set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "dependencies": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -2751,11 +4034,23 @@ "node": ">=0.10.0" } }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "node_modules/simple-peer": { "version": "9.11.1", @@ -2785,6 +4080,54 @@ "readable-stream": "^3.6.0" } }, + "node_modules/socket.io-client": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz", + "integrity": "sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/split": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.0.tgz", + "integrity": "sha512-3SVfJe2A0WZg3D+ZEtXqYkvpSGAVaZ1MgufNCeHioBESCqQFsuT1VcQufiopBfJZqh92ZwQ6ddL378iUSbqVNQ==", + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "dependencies": { + "internal-slot": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -2793,78 +4136,369 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tap-out": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tap-out/-/tap-out-2.1.0.tgz", + "integrity": "sha512-LJE+TBoVbOWhwdz4+FQk40nmbIuxJLqaGvj3WauQw3NYYU5TdjoV3C0x/yq37YAvVyi+oeBXmWnxWSjJ7IEyUw==", + "dependencies": { + "re-emitter": "1.1.3", + "readable-stream": "2.2.9", + "split": "1.0.0", + "trim": "0.0.1" + }, + "bin": { + "tap-out": "bin/cmd.js" + } + }, + "node_modules/tap-out/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/tap-out/node_modules/readable-stream": { + "version": "2.2.9", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "integrity": "sha512-iuxqX7b7FYt08AriYECxUsK9KTXE3A/FenxIa3IPmvANHxaTP/wGIwwf+IidvvIDk/MsCp/oEV6A8CXo4SDcCg==", + "dependencies": { + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/tap-out/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "node_modules/tap-out/node_modules/string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/tap-spec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tap-spec/-/tap-spec-5.0.0.tgz", + "integrity": "sha512-zMDVJiE5I6Y4XGjlueGXJIX2YIkbDN44broZlnypT38Hj/czfOXrszHNNJBF/DXR8n+x6gbfSx68x04kIEHdrw==", + "dependencies": { + "chalk": "^1.0.0", + "duplexer": "^0.1.1", + "figures": "^1.4.0", + "lodash": "^4.17.10", + "pretty-ms": "^2.1.0", + "repeat-string": "^1.5.2", + "tap-out": "^2.1.0", + "through2": "^2.0.0" + }, + "bin": { + "tap-spec": "bin/cmd.js", + "tspec": "bin/cmd.js" + } + }, + "node_modules/tap-spec/node_modules/ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tap-spec/node_modules/ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tap-spec/node_modules/chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tap-spec/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/tap-spec/node_modules/strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tap-spec/node_modules/supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/tape": { + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.6.6.tgz", + "integrity": "sha512-rGp2cZ3rfZ6QfTBm6yvohf8aXmDqPyzMKZwTMV12w4i+b/N2Adwlg8PlW8jLqWzlJUZhglyYaLOSrMt/ZlZkAA==", + "dependencies": { + "@ljharb/resumer": "^0.0.1", + "@ljharb/through": "^2.3.9", + "array.prototype.every": "^1.1.4", + "call-bind": "^1.0.2", + "deep-equal": "^2.2.2", + "defined": "^1.0.1", + "dotignore": "^0.1.2", + "for-each": "^0.3.3", + "get-package-type": "^0.1.0", + "glob": "^7.2.3", + "has": "^1.0.3", + "has-dynamic-import": "^2.0.1", + "inherits": "^2.0.4", + "is-regex": "^1.1.4", + "minimist": "^1.2.8", + "object-inspect": "^1.12.3", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "resolve": "^2.0.0-next.4", + "string.prototype.trim": "^1.2.7" + }, + "bin": { + "tape": "bin/tape" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tape/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=8" + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, + "node_modules/tape/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { - "ansi-regex": "^5.0.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" } }, - "node_modules/strip-hex-prefix": { + "node_modules/through2/node_modules/isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", - "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "node_modules/through2/node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "node_modules/through2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dependencies": { - "is-hex-prefixed": "1.0.0" - }, - "engines": { - "node": ">=6.5.0", - "npm": ">=3" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "node_modules/through2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, + "node_modules/through2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "safe-buffer": "~5.1.0" } }, "node_modules/to-regex-range": { @@ -2879,6 +4513,17 @@ "node": ">=8.0" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==", + "deprecated": "Use String.prototype.trim() instead" + }, "node_modules/ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -2922,6 +4567,36 @@ } } }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "node_modules/tus-js-client": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tus-js-client/-/tus-js-client-3.1.1.tgz", + "integrity": "sha512-SZzWP62jEFLmROSRZx+uoGLKqsYWMGK/m+PiNehPVWbCm7/S9zRIMaDxiaOcKdMnFno4luaqP5E+Y1iXXPjP0A==", + "dependencies": { + "buffer-from": "^1.1.2", + "combine-errors": "^3.0.3", + "is-stream": "^2.0.0", + "js-base64": "^3.7.2", + "lodash.throttle": "^4.1.1", + "proper-lockfile": "^4.1.2", + "url-parse": "^1.5.7" + } + }, + "node_modules/tus-js-client/node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -2941,6 +4616,67 @@ "node": ">=4" } }, + "node_modules/typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "dependencies": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/typescript": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", @@ -2954,6 +4690,37 @@ "node": ">=12.20" } }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2965,6 +4732,25 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "node_modules/video-stream-merger": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/video-stream-merger/-/video-stream-merger-4.0.1.tgz", + "integrity": "sha512-VazYSr8tk6S/zkOq5jpR/ryy1HnGxm5XCw+d2Ejpqy1m6d71oZpyFG82dUkgAo7dg/lk3k4TqvJPtuRUtR8URA==" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -2977,12 +4763,59 @@ "which": "bin/which" } }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", "dev": true }, + "node_modules/which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "dependencies": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", @@ -3009,14 +4842,12 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "peer": true, "engines": { "node": ">=8.3.0" }, @@ -3033,6 +4864,22 @@ } } }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -3104,9 +4951,46 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zustand": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.4.1.tgz", + "integrity": "sha512-QCPfstAS4EBiTQzlaGP1gmorkh/UL1Leaj2tdj+zZCZ/9bm0WS7sI2wnfD5lpOszFqWJ1DcPnGoY8RDL61uokw==", + "dependencies": { + "use-sync-external-store": "1.2.0" + }, + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@types/react": ">=16.8", + "immer": ">=9.0", + "react": ">=16.8" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + } + } } }, "dependencies": { + "@ambire/signature-validator": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@ambire/signature-validator/-/signature-validator-1.3.1.tgz", + "integrity": "sha512-kR6Se3nhAGf1VMeun7V2Lml9KRXB5oz64vO2zGSg+dNaGq4BPDEjsNdr0PIKXZ8651sDlRCN7V9SzL5E2ddBYQ==", + "requires": { + "ethers": "^5.6.5", + "tap-spec": "^5.0.0", + "tape": "^5.5.3" + } + }, "@chainsafe/as-sha256": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz", @@ -3158,7 +5042,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "peer": true, "requires": { "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", @@ -3175,7 +5058,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "peer": true, "requires": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -3190,7 +5072,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "peer": true, "requires": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", @@ -3203,7 +5084,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "peer": true, "requires": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -3216,7 +5096,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0" } @@ -3225,7 +5104,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/properties": "^5.7.0" @@ -3235,7 +5113,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", @@ -3245,8 +5122,7 @@ "bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "peer": true + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" } } }, @@ -3254,7 +5130,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "peer": true, "requires": { "@ethersproject/logger": "^5.7.0" } @@ -3263,7 +5138,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "peer": true, "requires": { "@ethersproject/bignumber": "^5.7.0" } @@ -3272,7 +5146,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", - "peer": true, "requires": { "@ethersproject/abi": "^5.7.0", "@ethersproject/abstract-provider": "^5.7.0", @@ -3290,7 +5163,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "peer": true, "requires": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", @@ -3307,7 +5179,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", - "peer": true, "requires": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/basex": "^5.7.0", @@ -3327,7 +5198,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", - "peer": true, "requires": { "@ethersproject/abstract-signer": "^5.7.0", "@ethersproject/address": "^5.7.0", @@ -3348,7 +5218,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "js-sha3": "0.8.0" @@ -3357,14 +5226,12 @@ "@ethersproject/logger": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", - "peer": true + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==" }, "@ethersproject/networks": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "peer": true, "requires": { "@ethersproject/logger": "^5.7.0" } @@ -3373,7 +5240,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/sha2": "^5.7.0" @@ -3383,7 +5249,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "peer": true, "requires": { "@ethersproject/logger": "^5.7.0" } @@ -3392,7 +5257,6 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", - "peer": true, "requires": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", @@ -3420,7 +5284,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0" @@ -3430,7 +5293,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0" @@ -3440,7 +5302,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", @@ -3451,7 +5312,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/logger": "^5.7.0", @@ -3464,8 +5324,7 @@ "bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "peer": true + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" } } }, @@ -3473,7 +5332,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", - "peer": true, "requires": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -3487,7 +5345,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/constants": "^5.7.0", @@ -3498,7 +5355,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "peer": true, "requires": { "@ethersproject/address": "^5.7.0", "@ethersproject/bignumber": "^5.7.0", @@ -3515,7 +5371,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "peer": true, "requires": { "@ethersproject/bignumber": "^5.7.0", "@ethersproject/constants": "^5.7.0", @@ -3526,7 +5381,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", - "peer": true, "requires": { "@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-signer": "^5.7.0", @@ -3549,7 +5403,6 @@ "version": "5.7.1", "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "peer": true, "requires": { "@ethersproject/base64": "^5.7.0", "@ethersproject/bytes": "^5.7.0", @@ -3562,7 +5415,6 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", - "peer": true, "requires": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/hash": "^5.7.0", @@ -3571,6 +5423,19 @@ "@ethersproject/strings": "^5.7.0" } }, + "@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==" + }, + "@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, "@jridgewell/resolve-uri": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", @@ -3593,6 +5458,38 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "@livepeer/core": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@livepeer/core/-/core-1.8.6.tgz", + "integrity": "sha512-VWMHaHMzNCr8YuC9hD87Ju+fwnpldEoe3y9CqOXrQPyyIgiAWfraZBA6Ard67f09X9UBGaaRcAMgMcCUs9HtKA==", + "requires": { + "cross-fetch": "^4.0.0", + "ms": "^3.0.0-canary.1", + "multiformats": "9.9.0", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + }, + "dependencies": { + "ms": { + "version": "3.0.0-canary.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz", + "integrity": "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g==" + } + } + }, + "@ljharb/resumer": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@ljharb/resumer/-/resumer-0.0.1.tgz", + "integrity": "sha512-skQiAOrCfO7vRTq53cxznMpks7wS1va95UCidALlOVWqvBAzwPVErwizDwoMqNVMEn1mDq0utxZd02eIrvF1lw==", + "requires": { + "@ljharb/through": "^2.3.9" + } + }, + "@ljharb/through": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.9.tgz", + "integrity": "sha512-yN599ZBuMPPK4tdoToLlvgJB4CLK8fGl7ntfy0Wn7U6ttNvHYurd81bfUiK/6sMkiIwm65R6ck4L6+Y3DfVbNQ==" + }, "@metamask/eth-sig-util": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-5.0.2.tgz", @@ -3616,6 +5513,15 @@ "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==" }, + "@pushprotocol/socket": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@pushprotocol/socket/-/socket-0.5.2.tgz", + "integrity": "sha512-lVGMT3q8T5by6qwAhQ+zIeE/yv7oUC9eIlFux8M7WaKu/ArLBrrojD5REbr9QXXwpJIP3Q8GJUKyClZl4uGsJw==", + "requires": { + "socket.io-client": "^4.5.2", + "tslib": "^2.3.0" + } + }, "@scure/base": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz", @@ -3640,6 +5546,34 @@ "@scure/base": "~1.1.0" } }, + "@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, + "@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" + }, + "@stitches/core": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz", + "integrity": "sha512-Gfkvwk9o9kE9r9XNBmJRfV8zONvXThnm1tcuojL04Uy5uRyqg93DC83lDebl0rocZCfKSjUv+fWYtMQmEDJldg==" + }, "@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -3713,8 +5647,7 @@ "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", - "peer": true + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, "ansi-colors": { "version": "4.1.1", @@ -3759,6 +5692,40 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "array-buffer-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz", + "integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==", + "requires": { + "call-bind": "^1.0.2", + "is-array-buffer": "^3.0.1" + } + }, + "array.prototype.every": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.5.tgz", + "integrity": "sha512-FfMQJ+/joFGXpRCltbzV3znaP5QxIhLFySo0fEPn3GuoYlud9LhknMCIxdYKC2qsM/6VHoSp6YGwe3EZXrEcwQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "is-string": "^1.0.7" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", + "requires": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", + "is-array-buffer": "^3.0.2", + "is-shared-array-buffer": "^1.0.2" + } + }, "asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -3776,11 +5743,15 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "available-typed-arrays": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base64-js": { "version": "1.5.1", @@ -3790,8 +5761,7 @@ "bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", - "peer": true + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, "binary-extensions": { "version": "2.2.0", @@ -3808,7 +5778,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3826,8 +5795,7 @@ "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "peer": true + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" }, "browser-stdout": { "version": "1.3.1", @@ -3844,6 +5812,25 @@ "ieee754": "^1.2.1" } }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "buffer-shims": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha512-Zy8ZXMyxIT6RMTeY7OP/bDndfj6bwCan7SS98CEndS6deHwWPpseeHlwarNcBim+etXnF9HBc1non5JgDaJU1g==" + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, "camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -3954,11 +5941,29 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "combine-errors": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/combine-errors/-/combine-errors-3.0.3.tgz", + "integrity": "sha512-C8ikRNRMygCwaTx+Ek3Yr+OuZzgZjduCOfSQBjbM8V3MfgcjSTeto/GXP6PAwKvJz/v15b7GHZvx5rOlczFw/Q==", + "requires": { + "custom-error-instance": "2.1.1", + "lodash.uniqby": "4.5.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "core-js": { + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz", + "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==" + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "create-require": { "version": "1.1.1", @@ -3966,6 +5971,14 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "requires": { + "node-fetch": "^2.6.12" + } + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -3984,6 +5997,11 @@ "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" }, + "custom-error-instance": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz", + "integrity": "sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg==" + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -4014,17 +6032,89 @@ "type-detect": "^4.0.0" } }, + "deep-equal": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", + "integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==", + "requires": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.1", + "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + } + }, + "define-data-property": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz", + "integrity": "sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==", + "requires": { + "get-intrinsic": "^1.2.1", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.0" + } + }, + "define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "defined": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", + "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==" + }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "dotignore": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", + "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", + "requires": { + "minimatch": "^3.0.4" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" + }, "elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "peer": true, "requires": { "bn.js": "^4.11.9", "brorand": "^1.1.0", @@ -4050,11 +6140,118 @@ "once": "^1.4.0" } }, + "engine.io-client": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz", + "integrity": "sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.11.0", + "xmlhttprequest-ssl": "~2.0.0" + }, + "dependencies": { + "ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "requires": {} + } + } + }, + "engine.io-parser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz", + "integrity": "sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ==" + }, "err-code": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz", "integrity": "sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA==" }, + "es-abstract": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", + "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", + "requires": { + "array-buffer-byte-length": "^1.0.0", + "arraybuffer.prototype.slice": "^1.0.2", + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "es-set-tostringtag": "^2.0.1", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.1", + "get-symbol-description": "^1.0.0", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has": "^1.0.3", + "has-property-descriptors": "^1.0.0", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "internal-slot": "^1.0.5", + "is-array-buffer": "^3.0.2", + "is-callable": "^1.2.7", + "is-negative-zero": "^2.0.2", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.12", + "is-weakref": "^1.0.2", + "object-inspect": "^1.12.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.1", + "safe-array-concat": "^1.0.1", + "safe-regex-test": "^1.0.0", + "string.prototype.trim": "^1.2.8", + "string.prototype.trimend": "^1.0.7", + "string.prototype.trimstart": "^1.0.7", + "typed-array-buffer": "^1.0.0", + "typed-array-byte-length": "^1.0.0", + "typed-array-byte-offset": "^1.0.0", + "typed-array-length": "^1.0.4", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.11" + } + }, + "es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + } + }, + "es-set-tostringtag": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", + "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "requires": { + "get-intrinsic": "^1.1.3", + "has": "^1.0.3", + "has-tostringtag": "^1.0.0" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -4082,7 +6279,6 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "peer": true, "requires": { "@ethersproject/abi": "5.7.0", "@ethersproject/abstract-provider": "5.7.0", @@ -4140,6 +6336,22 @@ "strip-eof": "^1.0.0" } }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==", + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + } + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -4165,11 +6377,18 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "requires": { + "is-callable": "^1.1.3" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "fsevents": { "version": "2.3.2", @@ -4178,6 +6397,27 @@ "dev": true, "optional": true }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==" + }, "get-browser-rtc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/get-browser-rtc/-/get-browser-rtc-1.1.0.tgz", @@ -4195,6 +6435,22 @@ "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", "dev": true }, + "get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + } + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==" + }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -4204,6 +6460,15 @@ "pump": "^3.0.0" } }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -4238,17 +6503,100 @@ "is-glob": "^4.0.1" } }, + "globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", + "requires": { + "define-properties": "^1.1.3" + } + }, + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "requires": { + "get-intrinsic": "^1.1.3" + } + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" + } + } + }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==" + }, + "has-dynamic-import": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz", + "integrity": "sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, + "has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "requires": { + "get-intrinsic": "^1.1.1" + } + }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==" + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "requires": { + "has-symbols": "^1.0.2" + } + }, "hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "peer": true, "requires": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" @@ -4260,11 +6608,15 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, + "hls.js": { + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.4.12.tgz", + "integrity": "sha512-1RBpx2VihibzE3WE9kGoVCtrhhDWTzydzElk/kyRbEOLnb1WIE+3ZabM/L8BqKFTCL3pUy4QzhXgD1Q6Igr1JA==" + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "peer": true, "requires": { "hash.js": "^1.0.3", "minimalistic-assert": "^1.0.0", @@ -4285,7 +6637,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -4296,12 +6647,49 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "internal-slot": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", + "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "requires": { + "get-intrinsic": "^1.2.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, "invert-kv": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, + "is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-array-buffer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", + "integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.0", + "is-typed-array": "^1.1.10" + } + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "requires": { + "has-bigints": "^1.0.1" + } + }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -4311,12 +6699,47 @@ "binary-extensions": "^2.0.0" } }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==" + }, + "is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true }, + "is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -4337,40 +6760,153 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==" }, + "is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==" + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==" + }, "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, + "is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, "is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==" + }, + "is-shared-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", + "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", + "requires": { + "call-bind": "^1.0.2" + } + }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", "dev": true }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typed-array": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz", + "integrity": "sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==", + "requires": { + "which-typed-array": "^1.1.11" + } + }, "is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true }, + "is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==" + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "joi": { + "version": "17.10.2", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.10.2.tgz", + "integrity": "sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, + "js-base64": { + "version": "3.7.5", + "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", + "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" + }, "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "peer": true }, "js-yaml": { @@ -4388,16 +6924,97 @@ "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", "dev": true, "requires": { - "invert-kv": "^2.0.0" + "invert-kv": "^2.0.0" + } + }, + "livepeer": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/livepeer/-/livepeer-2.8.6.tgz", + "integrity": "sha512-8K2lRtpgZKbv6l6cGYYMJW9qpdRKkGUuy7R7xTLkS6NaRQzaeW08vubftmbMHil8v8GX/nDmodcW2vA4oIkP0w==", + "requires": { + "@livepeer/core": "^1.8.6", + "@stitches/core": "^1.2.8", + "core-js": "^3.31.1", + "cross-fetch": "^4.0.0", + "hls.js": "^1.4.9", + "ms": "^3.0.0-canary.1", + "tus-js-client": "^3.1.0", + "zustand": "^4.3.9" + }, + "dependencies": { + "ms": { + "version": "3.0.0-canary.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz", + "integrity": "sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g==" + } + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "lodash._baseiteratee": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash._baseiteratee/-/lodash._baseiteratee-4.7.0.tgz", + "integrity": "sha512-nqB9M+wITz0BX/Q2xg6fQ8mLkyfF7MU7eE+MNBNjTHFKeKaZAPEzEg+E8LWxKWf1DQVflNEn9N49yAuqKh2mWQ==", + "requires": { + "lodash._stringtopath": "~4.8.0" + } + }, + "lodash._basetostring": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-4.12.0.tgz", + "integrity": "sha512-SwcRIbyxnN6CFEEK4K1y+zuApvWdpQdBHM/swxP962s8HIxPO3alBH5t3m/dl+f4CMUug6sJb7Pww8d13/9WSw==" + }, + "lodash._baseuniq": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz", + "integrity": "sha512-Ja1YevpHZctlI5beLA7oc5KNDhGcPixFhcqSiORHNsp/1QTv7amAXzw+gu4YOvErqVlMVyIJGgtzeepCnnur0A==", + "requires": { + "lodash._createset": "~4.0.0", + "lodash._root": "~3.0.0" + } + }, + "lodash._createset": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/lodash._createset/-/lodash._createset-4.0.3.tgz", + "integrity": "sha512-GTkC6YMprrJZCYU3zcqZj+jkXkrXzq3IPBcF/fIPpNEAB4hZEtXU8zp/RwKOvZl43NUmwDbyRk3+ZTbeRdEBXA==" + }, + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha512-O0pWuFSK6x4EXhM1dhZ8gchNtG7JMqBtrHdoUFUWXD7dJnNSUze1GuyQr5sOs0aCvgGeI3o/OJW8f4ca7FDxmQ==" + }, + "lodash._stringtopath": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/lodash._stringtopath/-/lodash._stringtopath-4.8.0.tgz", + "integrity": "sha512-SXL66C731p0xPDC5LZg4wI5H+dJo/EO4KTqOMwLYCH3+FmmfAKJEZCm6ohGpI+T1xwsDsJCfL4OnhorllvlTPQ==", + "requires": { + "lodash._basetostring": "~4.12.0" } }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, + "lodash.throttle": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", + "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==" + }, + "lodash.uniqby": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.5.0.tgz", + "integrity": "sha512-IRt7cfTtHy6f1aRVA5n7kT8rgN3N1nH6MOWLcHfpWG2SH19E3JksLK38MktLxZDhlAjCP9jpIXkOnRXlu6oByQ==", "requires": { - "p-locate": "^5.0.0" + "lodash._baseiteratee": "~4.7.0", + "lodash._baseuniq": "~4.6.0" } }, "log-symbols": { @@ -4410,6 +7027,15 @@ "is-unicode-supported": "^0.1.0" } }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -4459,8 +7085,7 @@ "minimalistic-crypto-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "peer": true + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, "minimatch": { "version": "5.0.1", @@ -4482,6 +7107,11 @@ } } }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" + }, "mocha": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", @@ -4786,6 +7416,11 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "multiformats": { + "version": "9.9.0", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz", + "integrity": "sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg==" + }, "nanoid": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", @@ -4798,6 +7433,14 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -4819,11 +7462,45 @@ "integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==", "dev": true }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + }, + "object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + }, + "object.assign": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", + "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.4", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "requires": { "wrappy": "1" } @@ -4889,6 +7566,11 @@ "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", "dev": true }, + "parse-ms": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-1.0.1.tgz", + "integrity": "sha512-LpH1Cf5EYuVjkBvCDBYvkUPh+iv2bk3FHflxHkpCYT0/FZ1d3N3uJaLiHr4yGuMcFUhv6eAivitTvWZI4B/chg==" + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -4898,8 +7580,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, "path-key": { "version": "2.0.1", @@ -4907,6 +7588,11 @@ "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", "dev": true }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, "pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -4919,6 +7605,36 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "plur": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/plur/-/plur-1.0.0.tgz", + "integrity": "sha512-qSnKBSZeDY8ApxwhfVIwKwF36KVJqb1/9nzYYq3j3vdwocULCXT8f8fQGkiw1Nk9BGfxiDagEe/pwakA+bOBqw==" + }, + "pretty-ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-2.1.0.tgz", + "integrity": "sha512-H2enpsxzDhuzRl3zeSQpQMirn8dB0Z/gxW96j06tMfTviUWvX14gjKb7qd1gtkUyYhDPuoNe00K5PqNvy2oQNg==", + "requires": { + "is-finite": "^1.0.1", + "parse-ms": "^1.0.0", + "plur": "^1.0.0" + } + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha512-yN0WQmuCX63LP/TMvAg31nvT6m4vDqJEiiv2CAZqWOGNWutc9DfDk1NPYYmKUFmaVM2UwDowH4u5AHWYP/jxKw==" + }, + "proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "requires": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -4929,6 +7645,11 @@ "once": "^1.3.1" } }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -4942,6 +7663,20 @@ "safe-buffer": "^5.1.0" } }, + "re-emitter": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/re-emitter/-/re-emitter-1.1.3.tgz", + "integrity": "sha512-bHJul9CWcocrS+w5e5QrKYXV9NkbSA9hxSEyhYuctwm6keY9NXR2Xt/4A0vbMP0QvuwyfEyb4bkowYXv1ziEbg==" + }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, "readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -4961,6 +7696,21 @@ "picomatch": "^2.2.1" } }, + "regexp.prototype.flags": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz", + "integrity": "sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "set-function-name": "^2.0.0" + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==" + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4973,11 +7723,52 @@ "integrity": "sha512-IqSUtOVP4ksd1C/ej5zeEh/BIP2ajqpn8c5x+q99gvcIG/Qf0cud5raVnE/Dwd0ua9TXYDoDc0RE5hBSdz22Ug==", "dev": true }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "resolve": { + "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", + "requires": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==" + }, + "safe-array-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + } + }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safe-regex-test": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", + "integrity": "sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "is-regex": "^1.1.4" + } + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -4986,8 +7777,7 @@ "scrypt-js": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", - "peer": true + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, "semver": { "version": "5.7.1", @@ -5010,6 +7800,16 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, + "set-function-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz", + "integrity": "sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==", + "requires": { + "define-data-property": "^1.0.1", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.0" + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -5025,11 +7825,20 @@ "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", "dev": true }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "simple-peer": { "version": "9.11.1", @@ -5045,6 +7854,42 @@ "readable-stream": "^3.6.0" } }, + "socket.io-client": { + "version": "4.7.2", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz", + "integrity": "sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.5.2", + "socket.io-parser": "~4.2.4" + } + }, + "socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + } + }, + "split": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.0.tgz", + "integrity": "sha512-3SVfJe2A0WZg3D+ZEtXqYkvpSGAVaZ1MgufNCeHioBESCqQFsuT1VcQufiopBfJZqh92ZwQ6ddL378iUSbqVNQ==", + "requires": { + "through": "2" + } + }, + "stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "requires": { + "internal-slot": "^1.0.4" + } + }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -5064,6 +7909,36 @@ "strip-ansi": "^6.0.1" } }, + "string.prototype.trim": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, + "string.prototype.trimstart": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" + } + }, "strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -5102,6 +7977,217 @@ "has-flag": "^4.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + }, + "tap-out": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tap-out/-/tap-out-2.1.0.tgz", + "integrity": "sha512-LJE+TBoVbOWhwdz4+FQk40nmbIuxJLqaGvj3WauQw3NYYU5TdjoV3C0x/yq37YAvVyi+oeBXmWnxWSjJ7IEyUw==", + "requires": { + "re-emitter": "1.1.3", + "readable-stream": "2.2.9", + "split": "1.0.0", + "trim": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "readable-stream": { + "version": "2.2.9", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "integrity": "sha512-iuxqX7b7FYt08AriYECxUsK9KTXE3A/FenxIa3IPmvANHxaTP/wGIwwf+IidvvIDk/MsCp/oEV6A8CXo4SDcCg==", + "requires": { + "buffer-shims": "~1.0.0", + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~1.0.0", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "tap-spec": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/tap-spec/-/tap-spec-5.0.0.tgz", + "integrity": "sha512-zMDVJiE5I6Y4XGjlueGXJIX2YIkbDN44broZlnypT38Hj/czfOXrszHNNJBF/DXR8n+x6gbfSx68x04kIEHdrw==", + "requires": { + "chalk": "^1.0.0", + "duplexer": "^0.1.1", + "figures": "^1.4.0", + "lodash": "^4.17.10", + "pretty-ms": "^2.1.0", + "repeat-string": "^1.5.2", + "tap-out": "^2.1.0", + "through2": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==" + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==" + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==" + } + } + }, + "tape": { + "version": "5.6.6", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.6.6.tgz", + "integrity": "sha512-rGp2cZ3rfZ6QfTBm6yvohf8aXmDqPyzMKZwTMV12w4i+b/N2Adwlg8PlW8jLqWzlJUZhglyYaLOSrMt/ZlZkAA==", + "requires": { + "@ljharb/resumer": "^0.0.1", + "@ljharb/through": "^2.3.9", + "array.prototype.every": "^1.1.4", + "call-bind": "^1.0.2", + "deep-equal": "^2.2.2", + "defined": "^1.0.1", + "dotignore": "^0.1.2", + "for-each": "^0.3.3", + "get-package-type": "^0.1.0", + "glob": "^7.2.3", + "has": "^1.0.3", + "has-dynamic-import": "^2.0.1", + "inherits": "^2.0.4", + "is-regex": "^1.1.4", + "minimist": "^1.2.8", + "object-inspect": "^1.12.3", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "resolve": "^2.0.0-next.4", + "string.prototype.trim": "^1.2.7" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -5111,6 +8197,16 @@ "is-number": "^7.0.0" } }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha512-YzQV+TZg4AxpKxaTHK3c3D+kRDCGVEE7LemdlQZoQXn0iennk10RsIoY6ikzAqJTc9Xjl9C1/waHom/J86ziAQ==" + }, "ts-node": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", @@ -5132,6 +8228,32 @@ "yn": "3.1.1" } }, + "tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + }, + "tus-js-client": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tus-js-client/-/tus-js-client-3.1.1.tgz", + "integrity": "sha512-SZzWP62jEFLmROSRZx+uoGLKqsYWMGK/m+PiNehPVWbCm7/S9zRIMaDxiaOcKdMnFno4luaqP5E+Y1iXXPjP0A==", + "requires": { + "buffer-from": "^1.1.2", + "combine-errors": "^3.0.3", + "is-stream": "^2.0.0", + "js-base64": "^3.7.2", + "lodash.throttle": "^4.1.1", + "proper-lockfile": "^4.1.2", + "url-parse": "^1.5.7" + }, + "dependencies": { + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==" + } + } + }, "tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -5148,12 +8270,81 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "typed-array-buffer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz", + "integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==", + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-byte-length": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz", + "integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==", + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz", + "integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "has-proto": "^1.0.1", + "is-typed-array": "^1.1.10" + } + }, + "typed-array-length": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz", + "integrity": "sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==", + "requires": { + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "is-typed-array": "^1.1.9" + } + }, "typescript": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz", "integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==", "dev": true }, + "unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "requires": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + } + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "requires": {} + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -5165,6 +8356,25 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "video-stream-merger": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/video-stream-merger/-/video-stream-merger-4.0.1.tgz", + "integrity": "sha512-VazYSr8tk6S/zkOq5jpR/ryy1HnGxm5XCw+d2Ejpqy1m6d71oZpyFG82dUkgAo7dg/lk3k4TqvJPtuRUtR8URA==" + }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -5174,12 +8384,47 @@ "isexe": "^2.0.0" } }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "requires": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", "dev": true }, + "which-typed-array": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", + "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "requires": { + "available-typed-arrays": "^1.0.5", + "call-bind": "^1.0.2", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.0" + } + }, "workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", @@ -5200,16 +8445,24 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "peer": true, "requires": {} }, + "xmlhttprequest-ssl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", + "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + }, "y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -5260,6 +8513,14 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true + }, + "zustand": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.4.1.tgz", + "integrity": "sha512-QCPfstAS4EBiTQzlaGP1gmorkh/UL1Leaj2tdj+zZCZ/9bm0WS7sI2wnfD5lpOszFqWJ1DcPnGoY8RDL61uokw==", + "requires": { + "use-sync-external-store": "1.2.0" + } } } } diff --git a/packages/restapi/package.json b/packages/restapi/package.json index fc72b0867..7d07fba25 100644 --- a/packages/restapi/package.json +++ b/packages/restapi/package.json @@ -1,6 +1,6 @@ { "name": "@pushprotocol/restapi", - "version": "1.4.11", + "version": "1.4.22", "type": "commonjs", "publishConfig": { "registry": "https://registry.npmjs.org/" @@ -11,6 +11,7 @@ "dependencies": { "@ambire/signature-validator": "^1.3.1", "@metamask/eth-sig-util": "^5.0.2", + "@pushprotocol/socket": "^0.5.2", "buffer": "^6.0.3", "crypto-js": "^4.1.1", "immer": "^10.0.2", diff --git a/packages/restapi/project.json b/packages/restapi/project.json index 90d27ba83..6f7ec7b4b 100644 --- a/packages/restapi/project.json +++ b/packages/restapi/project.json @@ -35,7 +35,7 @@ "options": { "preset": "angular", "commitMessageFormat": "ci(${projectName}): 🎉 cut release to ${projectName}-v${version}", - "postTargets": ["restapi:build", "restapi:ci-publish"] + "postTargets": ["socket:build", "restapi:build", "restapi:ci-publish"] } }, "ci-version-beta": { @@ -43,7 +43,7 @@ "options": { "preset": "angular", "commitMessageFormat": "ci(${projectName}): 🎉 cut beta release to ${projectName}-v${version}", - "postTargets": ["restapi:build", "restapi:ci-publish"], + "postTargets": ["socket:build", "restapi:build", "restapi:ci-publish"], "version": "prerelease", "preid": "alpha" } diff --git a/packages/restapi/src/lib/abis/comm.ts b/packages/restapi/src/lib/abis/comm.ts new file mode 100644 index 000000000..31b7c27d7 --- /dev/null +++ b/packages/restapi/src/lib/abis/comm.ts @@ -0,0 +1,520 @@ +export const commABI = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'delegate', + type: 'address', + }, + ], + name: 'AddDelegate', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'string', + name: '_chainName', + type: 'string', + }, + { + indexed: true, + internalType: 'uint256', + name: '_chainID', + type: 'uint256', + }, + { + indexed: true, + internalType: 'address', + name: '_channelOwnerAddress', + type: 'address', + }, + { + indexed: false, + internalType: 'string', + name: '_ethereumChannelAddress', + type: 'string', + }, + ], + name: 'ChannelAlias', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes', + name: 'publickey', + type: 'bytes', + }, + ], + name: 'PublicKeyRegistered', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'delegate', + type: 'address', + }, + ], + name: 'RemoveDelegate', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'recipient', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes', + name: 'identity', + type: 'bytes', + }, + ], + name: 'SendNotification', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + ], + name: 'Subscribe', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + ], + name: 'Unsubscribe', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: '_channel', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: '_user', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: '_notifID', + type: 'uint256', + }, + { + indexed: false, + internalType: 'string', + name: '_notifSettings', + type: 'string', + }, + ], + name: 'UserNotifcationSettingsAdded', + type: 'event', + }, + { + inputs: [], + name: 'DOMAIN_TYPEHASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'EPNSCoreAddress', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'NAME_HASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'SEND_NOTIFICATION_TYPEHASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'SUBSCRIBE_TYPEHASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'UNSUBSCRIBE_TYPEHASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_delegate', type: 'address' }], + name: 'addDelegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address[]', name: '_channelList', type: 'address[]' }, + ], + name: 'batchSubscribe', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address[]', name: '_channelList', type: 'address[]' }, + ], + name: 'batchUnsubscribe', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: '_publicKey', type: 'bytes' }], + name: 'broadcastUserPublicKey', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'chainID', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'chainName', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channel', type: 'address' }, + { internalType: 'uint256', name: '_notifID', type: 'uint256' }, + { internalType: 'string', name: '_notifSettings', type: 'string' }, + ], + name: 'changeUserChannelSettings', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'completeMigration', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '', type: 'address' }, + { internalType: 'address', name: '', type: 'address' }, + ], + name: 'delegatedNotificationSenders', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: '_publicKey', type: 'bytes' }], + name: 'getWalletFromPublicKey', + outputs: [{ internalType: 'address', name: 'wallet', type: 'address' }], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [], + name: 'governance', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_pushChannelAdmin', type: 'address' }, + { internalType: 'string', name: '_chainName', type: 'string' }, + ], + name: 'initialize', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'isMigrationComplete', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channel', type: 'address' }, + { internalType: 'address', name: '_user', type: 'address' }, + ], + name: 'isUserSubscribed', + outputs: [{ internalType: 'bool', name: 'isSubscriber', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'mapAddressUsers', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_startIndex', type: 'uint256' }, + { internalType: 'uint256', name: '_endIndex', type: 'uint256' }, + { internalType: 'address[]', name: '_channelList', type: 'address[]' }, + { internalType: 'address[]', name: '_usersList', type: 'address[]' }, + ], + name: 'migrateSubscribeData', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'nonces', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'pushChannelAdmin', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_delegate', type: 'address' }], + name: 'removeDelegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channel', type: 'address' }, + { internalType: 'address', name: '_recipient', type: 'address' }, + { internalType: 'bytes', name: '_identity', type: 'bytes' }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { internalType: 'uint256', name: 'expiry', type: 'uint256' }, + { internalType: 'uint8', name: 'v', type: 'uint8' }, + { internalType: 'bytes32', name: 'r', type: 'bytes32' }, + { internalType: 'bytes32', name: 's', type: 'bytes32' }, + ], + name: 'sendNotifBySig', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channel', type: 'address' }, + { internalType: 'address', name: '_recipient', type: 'address' }, + { internalType: 'bytes', name: '_identity', type: 'bytes' }, + ], + name: 'sendNotification', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_coreAddress', type: 'address' }, + ], + name: 'setEPNSCoreAddress', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_governanceAddress', type: 'address' }, + ], + name: 'setGovernanceAddress', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_channel', type: 'address' }], + name: 'subscribe', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'channel', type: 'address' }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { internalType: 'uint256', name: 'expiry', type: 'uint256' }, + { internalType: 'uint8', name: 'v', type: 'uint8' }, + { internalType: 'bytes32', name: 'r', type: 'bytes32' }, + { internalType: 'bytes32', name: 's', type: 'bytes32' }, + ], + name: 'subscribeBySig', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channel', type: 'address' }, + { internalType: 'address', name: '_user', type: 'address' }, + ], + name: 'subscribeViaCore', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_newAdmin', type: 'address' }], + name: 'transferPushChannelAdminControl', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_channel', type: 'address' }], + name: 'unsubscribe', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'channel', type: 'address' }, + { internalType: 'uint256', name: 'nonce', type: 'uint256' }, + { internalType: 'uint256', name: 'expiry', type: 'uint256' }, + { internalType: 'uint8', name: 'v', type: 'uint8' }, + { internalType: 'bytes32', name: 'r', type: 'bytes32' }, + { internalType: 'bytes32', name: 's', type: 'bytes32' }, + ], + name: 'unsubscribeBySig', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '', type: 'address' }, + { internalType: 'address', name: '', type: 'address' }, + ], + name: 'userToChannelNotifs', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'users', + outputs: [ + { internalType: 'bool', name: 'userActivated', type: 'bool' }, + { internalType: 'bool', name: 'publicKeyRegistered', type: 'bool' }, + { internalType: 'uint256', name: 'userStartBlock', type: 'uint256' }, + { internalType: 'uint256', name: 'subscribedCount', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'usersCount', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'string', name: '_channelAddress', type: 'string' }, + ], + name: 'verifyChannelAlias', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/packages/restapi/src/lib/abis/core.ts b/packages/restapi/src/lib/abis/core.ts new file mode 100644 index 000000000..6032a8b3d --- /dev/null +++ b/packages/restapi/src/lib/abis/core.ts @@ -0,0 +1,957 @@ +export const coreABI = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'enum EPNSCoreStorageV1_5.ChannelType', + name: 'channelType', + type: 'uint8', + }, + { + indexed: false, + internalType: 'bytes', + name: 'identity', + type: 'bytes', + }, + ], + name: 'AddChannel', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes', + name: '_subGraphData', + type: 'bytes', + }, + ], + name: 'AddSubGraph', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + ], + name: 'ChannelBlocked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: '_channel', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'totalNotifOptions', + type: 'uint256', + }, + { + indexed: false, + internalType: 'string', + name: '_notifSettings', + type: 'string', + }, + { + indexed: false, + internalType: 'string', + name: '_notifDescription', + type: 'string', + }, + ], + name: 'ChannelNotifcationSettingsAdded', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'ChannelOwnershipTransfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'revoker', + type: 'address', + }, + ], + name: 'ChannelVerificationRevoked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'verifier', + type: 'address', + }, + ], + name: 'ChannelVerified', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { + indexed: true, + internalType: 'uint256', + name: 'amountClaimed', + type: 'uint256', + }, + ], + name: 'ChatIncentiveClaimed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amountRefunded', + type: 'uint256', + }, + ], + name: 'DeactivateChannel', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'requestSender', + type: 'address', + }, + { + indexed: false, + internalType: 'address', + name: 'requestReceiver', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amountForReqReceiver', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'feePoolAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'timestamp', + type: 'uint256', + }, + ], + name: 'IncentivizeChatReqReceived', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'Paused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amountDeposited', + type: 'uint256', + }, + ], + name: 'ReactivateChannel', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { + indexed: false, + internalType: 'uint256', + name: 'rewardAmount', + type: 'uint256', + }, + ], + name: 'RewardsClaimed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { + indexed: true, + internalType: 'uint256', + name: 'rewardAmount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'fromEpoch', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'tillEpoch', + type: 'uint256', + }, + ], + name: 'RewardsHarvested', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { + indexed: true, + internalType: 'uint256', + name: 'amountStaked', + type: 'uint256', + }, + ], + name: 'Staked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amountRefunded', + type: 'uint256', + }, + ], + name: 'TimeBoundChannelDestroyed', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'Unpaused', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: 'address', name: 'user', type: 'address' }, + { + indexed: true, + internalType: 'uint256', + name: 'amountUnstaked', + type: 'uint256', + }, + ], + name: 'Unstaked', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'channel', + type: 'address', + }, + { + indexed: false, + internalType: 'bytes', + name: 'identity', + type: 'bytes', + }, + { + indexed: true, + internalType: 'uint256', + name: 'amountDeposited', + type: 'uint256', + }, + ], + name: 'UpdateChannel', + type: 'event', + }, + { + inputs: [], + name: 'ADD_CHANNEL_MIN_FEES', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'CHANNEL_POOL_FUNDS', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'CREATE_CHANNEL_TYPEHASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'DOMAIN_TYPEHASH', + outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'FEE_AMOUNT', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'MIN_POOL_CONTRIBUTION', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'PROTOCOL_POOL_FEES', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'PUSH_TOKEN_ADDRESS', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'REFERRAL_CODE', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'UNISWAP_V2_ROUTER', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'WETH_ADDRESS', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'aDaiAddress', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_rewardAmount', type: 'uint256' }, + ], + name: 'addPoolFees', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'bytes', name: '_subGraphData', type: 'bytes' }], + name: 'addSubGraph', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_startIndex', type: 'uint256' }, + { internalType: 'uint256', name: '_endIndex', type: 'uint256' }, + { internalType: 'address[]', name: '_channelList', type: 'address[]' }, + ], + name: 'batchVerification', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channelAddress', type: 'address' }, + ], + name: 'blockChannel', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_user', type: 'address' }, + { internalType: 'uint256', name: '_epochId', type: 'uint256' }, + ], + name: 'calculateEpochRewards', + outputs: [{ internalType: 'uint256', name: 'rewards', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'celebUserFunds', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'channelById', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'channelNotifSettings', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'channelUpdateCounter', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'channels', + outputs: [ + { + internalType: 'enum EPNSCoreStorageV1_5.ChannelType', + name: 'channelType', + type: 'uint8', + }, + { internalType: 'uint8', name: 'channelState', type: 'uint8' }, + { internalType: 'address', name: 'verifiedBy', type: 'address' }, + { internalType: 'uint256', name: 'poolContribution', type: 'uint256' }, + { internalType: 'uint256', name: 'channelHistoricalZ', type: 'uint256' }, + { + internalType: 'uint256', + name: 'channelFairShareCount', + type: 'uint256', + }, + { internalType: 'uint256', name: 'channelLastUpdate', type: 'uint256' }, + { internalType: 'uint256', name: 'channelStartBlock', type: 'uint256' }, + { internalType: 'uint256', name: 'channelUpdateBlock', type: 'uint256' }, + { internalType: 'uint256', name: 'channelWeight', type: 'uint256' }, + { internalType: 'uint256', name: 'expiryTime', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'channelsCount', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }], + name: 'claimChatIncentives', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_notifOptions', type: 'uint256' }, + { internalType: 'string', name: '_notifSettings', type: 'string' }, + { internalType: 'string', name: '_notifDescription', type: 'string' }, + { internalType: 'uint256', name: '_amountDeposited', type: 'uint256' }, + ], + name: 'createChannelSettings', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'enum EPNSCoreStorageV1_5.ChannelType', + name: '_channelType', + type: 'uint8', + }, + { internalType: 'bytes', name: '_identity', type: 'bytes' }, + { internalType: 'uint256', name: '_amount', type: 'uint256' }, + { internalType: 'uint256', name: '_channelExpiryTime', type: 'uint256' }, + ], + name: 'createChannelWithPUSH', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'daiAddress', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_tillEpoch', type: 'uint256' }], + name: 'daoHarvestPaginated', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'deactivateChannel', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channelAddress', type: 'address' }, + ], + name: 'destroyTimeBoundChannel', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'epnsCommunicator', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'epochDuration', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'epochRewards', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + name: 'epochToTotalStakedWeight', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'genesisEpoch', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_channel', type: 'address' }], + name: 'getChannelVerfication', + outputs: [ + { internalType: 'uint8', name: 'verificationStatus', type: 'uint8' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'governance', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'groupFairShareCount', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'groupHistoricalZ', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'groupLastUpdate', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'groupNormalizedWeight', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: 'requestSender', type: 'address' }, + { internalType: 'address', name: 'requestReceiver', type: 'address' }, + { internalType: 'uint256', name: 'amount', type: 'uint256' }, + ], + name: 'handleChatRequestData', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'harvestAll', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_tillEpoch', type: 'uint256' }], + name: 'harvestPaginated', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_pushChannelAdmin', type: 'address' }, + { internalType: 'address', name: '_pushTokenAddress', type: 'address' }, + { internalType: 'address', name: '_wethAddress', type: 'address' }, + { + internalType: 'address', + name: '_uniswapRouterAddress', + type: 'address', + }, + { + internalType: 'address', + name: '_lendingPoolProviderAddress', + type: 'address', + }, + { internalType: 'address', name: '_daiAddress', type: 'address' }, + { internalType: 'address', name: '_aDaiAddress', type: 'address' }, + { internalType: 'uint256', name: '_referralCode', type: 'uint256' }, + ], + name: 'initialize', + outputs: [{ internalType: 'bool', name: 'success', type: 'bool' }], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'initializeStake', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'isMigrationComplete', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { internalType: 'uint256', name: '_from', type: 'uint256' }, + { internalType: 'uint256', name: '_to', type: 'uint256' }, + ], + name: 'lastEpochRelative', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'lendingPoolProviderAddress', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [{ internalType: 'string', name: '', type: 'string' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'nonces', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'pauseContract', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'paused', + outputs: [{ internalType: 'bool', name: '', type: 'bool' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'previouslySetEpochRewards', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'pushChannelAdmin', + outputs: [{ internalType: 'address', name: '', type: 'address' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }], + name: 'reactivateChannel', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_commAddress', type: 'address' }, + ], + name: 'setEpnsCommunicatorAddress', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_newFees', type: 'uint256' }], + name: 'setFeeAmount', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_governanceAddress', type: 'address' }, + ], + name: 'setGovernanceAddress', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_newFees', type: 'uint256' }], + name: 'setMinChannelCreationFees', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_newAmount', type: 'uint256' }], + name: 'setMinPoolContribution', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'uint256', name: '_amount', type: 'uint256' }], + name: 'stake', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'totalStakedAmount', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_newAdmin', type: 'address' }], + name: 'transferPushChannelAdminControl', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'unPauseContract', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'unstake', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_channel', type: 'address' }], + name: 'unverifyChannel', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { internalType: 'address', name: '_channel', type: 'address' }, + { internalType: 'bytes', name: '_newIdentity', type: 'bytes' }, + { internalType: 'uint256', name: '_amount', type: 'uint256' }, + ], + name: 'updateChannelMeta', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'userFeesInfo', + outputs: [ + { internalType: 'uint256', name: 'stakedAmount', type: 'uint256' }, + { internalType: 'uint256', name: 'stakedWeight', type: 'uint256' }, + { internalType: 'uint256', name: 'lastStakedBlock', type: 'uint256' }, + { internalType: 'uint256', name: 'lastClaimedBlock', type: 'uint256' }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '', type: 'address' }], + name: 'usersRewardsClaimed', + outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [{ internalType: 'address', name: '_channel', type: 'address' }], + name: 'verifyChannel', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/packages/restapi/src/lib/abis/token.ts b/packages/restapi/src/lib/abis/token.ts new file mode 100644 index 000000000..a68265ba9 --- /dev/null +++ b/packages/restapi/src/lib/abis/token.ts @@ -0,0 +1,709 @@ +export const tokenABI = [ + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + stateMutability: 'nonpayable', + type: 'constructor', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'delegator', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'fromDelegate', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'toDelegate', + type: 'address', + }, + ], + name: 'DelegateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'delegate', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'previousBalance', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'newBalance', + type: 'uint256', + }, + ], + name: 'DelegateVotesChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'holder', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'weight', + type: 'uint256', + }, + ], + name: 'HolderWeightChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + inputs: [], + name: 'DELEGATION_TYPEHASH', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'DOMAIN_TYPEHASH', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'PERMIT_TYPEHASH', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rawAmount', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'born', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'rawAmount', + type: 'uint256', + }, + ], + name: 'burn', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'uint32', + name: '', + type: 'uint32', + }, + ], + name: 'checkpoints', + outputs: [ + { + internalType: 'uint32', + name: 'fromBlock', + type: 'uint32', + }, + { + internalType: 'uint96', + name: 'votes', + type: 'uint96', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'delegatee', + type: 'address', + }, + ], + name: 'delegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'delegatee', + type: 'address', + }, + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'expiry', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'delegateBySig', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'delegates', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'getCurrentVotes', + outputs: [ + { + internalType: 'uint96', + name: '', + type: 'uint96', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint256', + name: 'blockNumber', + type: 'uint256', + }, + ], + name: 'getPriorVotes', + outputs: [ + { + internalType: 'uint96', + name: '', + type: 'uint96', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'holderDelegation', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'holderWeight', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'nonces', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'numCheckpoints', + outputs: [ + { + internalType: 'uint32', + name: '', + type: 'uint32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rawAmount', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'deadline', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'permit', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'holder', + type: 'address', + }, + ], + name: 'resetHolderWeight', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'address', + name: 'delegate', + type: 'address', + }, + ], + name: 'returnHolderDelegation', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'returnHolderRatio', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'delegate', + type: 'address', + }, + { + internalType: 'bool', + name: 'value', + type: 'bool', + }, + ], + name: 'setHolderDelegation', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'dst', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rawAmount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'src', + type: 'address', + }, + { + internalType: 'address', + name: 'dst', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rawAmount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/packages/restapi/src/lib/alias/getAliasInfo.ts b/packages/restapi/src/lib/alias/getAliasInfo.ts index e0413319f..549e73b25 100644 --- a/packages/restapi/src/lib/alias/getAliasInfo.ts +++ b/packages/restapi/src/lib/alias/getAliasInfo.ts @@ -34,7 +34,7 @@ export const getAliasInfo = async ( const aliasChainId:number = ALIAS_CHAIN_ID[aliasChain][env]; const _alias = getCAIPWithChainId(alias, aliasChainId, 'Alias'); - console.log(_alias) + // console.log(_alias) const API_BASE_URL = getAPIBaseUrls(env); const apiEndpoint = `${API_BASE_URL}/v1/alias`; const requestUrl = `${apiEndpoint}/${_alias}/channel`; diff --git a/packages/restapi/src/lib/channels/index.ts b/packages/restapi/src/lib/channels/index.ts index 51f12c24e..6e584d9d3 100644 --- a/packages/restapi/src/lib/channels/index.ts +++ b/packages/restapi/src/lib/channels/index.ts @@ -4,4 +4,6 @@ export * from './search'; export * from './subscribe'; export * from './unsubscribe'; export * from './_getSubscribers'; -export * from './getSubscribers'; \ No newline at end of file +export * from './getSubscribers'; +export * from './subscribeV2'; +export * from './unsubscribeV2'; diff --git a/packages/restapi/src/lib/channels/signature.helpers.ts b/packages/restapi/src/lib/channels/signature.helpers.ts index 33f977f4e..fadb4e480 100644 --- a/packages/restapi/src/lib/channels/signature.helpers.ts +++ b/packages/restapi/src/lib/channels/signature.helpers.ts @@ -1,47 +1,77 @@ - -type channelActionType = "Unsubscribe" | "Subscribe"; +type channelActionType = 'Unsubscribe' | 'Subscribe'; export const getDomainInformation = ( chainId: number, verifyingContract: string ) => { return { - name: "EPNS COMM V1", + name: 'EPNS COMM V1', chainId, verifyingContract, }; -} - +}; + export const getSubscriptionMessage = ( channel: string, userAddress: string, action: channelActionType ) => { - const actionTypeKey = (action === "Unsubscribe") ? "unsubscriber" : "subscriber"; - + const actionTypeKey = + action === 'Unsubscribe' ? 'unsubscriber' : 'subscriber'; + return { channel, [actionTypeKey]: userAddress, action: action, }; -} +}; + +export const getSubscriptionMessageV2 = ( + channel: string, + userAddress: string, + action: channelActionType, + userSetting?: string | null +) => { + const actionTypeKey = + action === 'Unsubscribe' ? 'unsubscriber' : 'subscriber'; + if (action == 'Subscribe') { + return JSON.stringify({ + channel, + [actionTypeKey]: userAddress, + action: action, + userSetting: userSetting?? '', + }, null, 4); + } else { + return JSON.stringify({ + channel, + [actionTypeKey]: userAddress, + action: action, + }, null, 4); + } +}; export const getTypeInformation = (action: string) => { - if (action === "Subscribe") { + if (action === 'Subscribe') { return { Subscribe: [ - { name: "channel", type: "address" }, - { name: "subscriber", type: "address" }, - { name: "action", type: "string" }, + { name: 'channel', type: 'address' }, + { name: 'subscriber', type: 'address' }, + { name: 'action', type: 'string' }, ], }; } return { Unsubscribe: [ - { name: "channel", type: "address" }, - { name: "unsubscriber", type: "address" }, - { name: "action", type: "string" }, + { name: 'channel', type: 'address' }, + { name: 'unsubscriber', type: 'address' }, + { name: 'action', type: 'string' }, ], }; -}; \ No newline at end of file +}; + +export const getTypeInformationV2 = () => { + return { + Data: [{ name: 'data', type: 'string' }], + }; +}; diff --git a/packages/restapi/src/lib/channels/subscribeV2.ts b/packages/restapi/src/lib/channels/subscribeV2.ts new file mode 100644 index 000000000..b86b8e937 --- /dev/null +++ b/packages/restapi/src/lib/channels/subscribeV2.ts @@ -0,0 +1,111 @@ +import axios from 'axios'; +import { + getCAIPAddress, + getConfig, + getCAIPDetails, + signTypedData, +} from '../helpers'; +import { + getDomainInformation, + getTypeInformationV2, + getSubscriptionMessageV2, +} from './signature.helpers'; +import Constants, { ENV } from '../constants'; +import { SignerType } from '../types'; + +export type SubscribeOptionsV2Type = { + signer: SignerType; + channelAddress: string; + userAddress: string; + settings?: string | null; + verifyingContractAddress?: string; + env?: ENV; + onSuccess?: () => void; + onError?: (err: Error) => void; +}; + +export const subscribeV2 = async (options: SubscribeOptionsV2Type) => { + const { + signer, + channelAddress, + userAddress, + settings = undefined, + verifyingContractAddress, + env = Constants.ENV.PROD, + onSuccess, + onError, + } = options || {}; + try { + const _channelAddress = await getCAIPAddress( + env, + channelAddress, + 'Channel' + ); + + const channelCAIPDetails = getCAIPDetails(_channelAddress); + if (!channelCAIPDetails) throw Error('Invalid Channel CAIP!'); + + const chainId = parseInt(channelCAIPDetails.networkId, 10); + + const _userAddress = await getCAIPAddress(env, userAddress, 'User'); + + const userCAIPDetails = getCAIPDetails(_userAddress); + if (!userCAIPDetails) throw Error('Invalid User CAIP!'); + + const { API_BASE_URL, EPNS_COMMUNICATOR_CONTRACT } = getConfig( + env, + channelCAIPDetails + ); + + const requestUrl = `${API_BASE_URL}/v1/channels/${_channelAddress}/subscribe`; + // get domain information + const domainInformation = getDomainInformation( + chainId, + verifyingContractAddress || EPNS_COMMUNICATOR_CONTRACT + ); + + // get type information + const typeInformation = getTypeInformationV2(); + + // get message + const messageInformation = { + data: getSubscriptionMessageV2( + channelCAIPDetails.address, + userCAIPDetails.address, + 'Subscribe', + settings + ), + }; + // sign a message using EIP712 + const signature = await signTypedData( + signer, + domainInformation, + typeInformation, + messageInformation, + 'Data' + ); + + const verificationProof = signature; // might change + + const body = { + verificationProof: `eip712v2:${verificationProof}`, + message: + messageInformation.data, + + }; + + const res = await axios.post(requestUrl, body); + + if (typeof onSuccess === 'function') onSuccess(); + + return { status: res.status, message: 'successfully opted into channel' }; + } catch (err: any) { + + if (typeof onError === 'function') onError(err as Error); + + return { + status: err?.response?.status?? '' , + message: err instanceof Error ? err.message : JSON.stringify(err), + }; + } +}; diff --git a/packages/restapi/src/lib/channels/unsubscribeV2.ts b/packages/restapi/src/lib/channels/unsubscribeV2.ts new file mode 100644 index 000000000..f792fb782 --- /dev/null +++ b/packages/restapi/src/lib/channels/unsubscribeV2.ts @@ -0,0 +1,110 @@ +import axios from 'axios'; +import { + getCAIPAddress, + getConfig, + getCAIPDetails, + signTypedData, +} from '../helpers'; +import { + getTypeInformation, + getDomainInformation, + getSubscriptionMessage, + getTypeInformationV2, + getSubscriptionMessageV2, +} from './signature.helpers'; +import Constants, { ENV } from '../constants'; +import { SignerType } from '../types'; + +export type UnSubscribeOptionsV2Type = { + signer: SignerType; + channelAddress: string; + userAddress: string; + verifyingContractAddress?: string; + env?: ENV; + onSuccess?: () => void; + onError?: (err: Error) => void; +}; + +export const unsubscribeV2 = async (options: UnSubscribeOptionsV2Type) => { + const { + signer, + channelAddress, + userAddress, + verifyingContractAddress, + env = Constants.ENV.PROD, + onSuccess, + onError, + } = options || {}; + + try { + const _channelAddress = await getCAIPAddress( + env, + channelAddress, + 'Channel' + ); + + const channelCAIPDetails = getCAIPDetails(_channelAddress); + if (!channelCAIPDetails) throw Error('Invalid Channel CAIP!'); + + const chainId = parseInt(channelCAIPDetails.networkId, 10); + + const _userAddress = await getCAIPAddress(env, userAddress, 'User'); + + const userCAIPDetails = getCAIPDetails(_userAddress); + if (!userCAIPDetails) throw Error('Invalid User CAIP!'); + + const { API_BASE_URL, EPNS_COMMUNICATOR_CONTRACT } = getConfig( + env, + channelCAIPDetails + ); + + const requestUrl = `${API_BASE_URL}/v1/channels/${_channelAddress}/unsubscribe`; + + // get domain information + const domainInformation = getDomainInformation( + chainId, + verifyingContractAddress || EPNS_COMMUNICATOR_CONTRACT + ); + + // get type information + const typeInformation = getTypeInformationV2(); + + // get message + const messageInformation = { + data: getSubscriptionMessageV2( + channelCAIPDetails.address, + userCAIPDetails.address, + 'Unsubscribe' + ), + }; + + // sign a message using EIP712 + const signature = await signTypedData( + signer, + domainInformation, + typeInformation, + messageInformation, + 'Unsubscribe' + ); + + const verificationProof = signature; // might change + + const body = { + verificationProof: `eip712v2:${verificationProof}`, + message: messageInformation.data, + }; + + const res = await axios.post(requestUrl, body); + + if (typeof onSuccess === 'function') onSuccess(); + + return { status: res.status, message: 'successfully opted into channel' }; + } catch (err: any) { + if (typeof onError === 'function') onError(err as Error); + + return { + status: err?.response?.status?? '' , + message: err instanceof Error ? err.message : JSON.stringify(err), + }; + } +}; diff --git a/packages/restapi/src/lib/chat/getGroupMemberStatus.ts b/packages/restapi/src/lib/chat/getGroupMemberStatus.ts new file mode 100644 index 000000000..8c9f0282c --- /dev/null +++ b/packages/restapi/src/lib/chat/getGroupMemberStatus.ts @@ -0,0 +1,54 @@ +import axios from 'axios'; +import { getAPIBaseUrls } from '../helpers'; +import Constants, { ENV } from '../constants'; +import { GroupAccess, GroupMemberStatus } from '../types'; +import { getUserDID } from './helpers'; + +/** + * GET /v1/chat/groups/:chatId/access/:did + */ + +export interface GetGroupMemberStatusType { + chatId: string; + did: string; // Decentralized Identifier + env?: ENV; +} + +export const getGroupMemberStatus = async ( + options: GetGroupMemberStatusType +): Promise<GroupMemberStatus> => { + // Replace "any" with the actual response type + const { chatId, did, env = Constants.ENV.PROD } = options || {}; + try { + if (chatId == null || chatId.length === 0) { + throw new Error(`chatId cannot be null or empty`); + } + + if (did == null || did.length === 0) { + throw new Error(`did cannot be null or empty`); + } + + const user = await getUserDID(did, env); + + const API_BASE_URL = getAPIBaseUrls(env); + const requestUrl = `${API_BASE_URL}/v1/chat/groups/${chatId}/members/${user}/status`; + + return axios + .get(requestUrl) + .then((response) => { + return response.data; + }) + .catch((err) => { + if (err?.response?.data) throw new Error(err?.response?.data); + throw new Error(err); + }); + } catch (err) { + console.error( + `[Push SDK] - API - Error - API ${getGroupMemberStatus.name} -: `, + err + ); + throw Error( + `[Push SDK] - API - Error - API ${getGroupMemberStatus.name} -: ${err}` + ); + } +}; diff --git a/packages/restapi/src/lib/chat/helpers/inbox.ts b/packages/restapi/src/lib/chat/helpers/inbox.ts index b243e2b78..f73f9a735 100644 --- a/packages/restapi/src/lib/chat/helpers/inbox.ts +++ b/packages/restapi/src/lib/chat/helpers/inbox.ts @@ -171,23 +171,31 @@ export const decryptConversation = async (options: DecryptConverationType) => { const message = messages[i]; let gotOtherPeer = false; if (message.encType !== 'PlainText') { - if (!pgpPrivateKey) { - throw Error('Decrypted private key is necessary'); - } - if (message.fromCAIP10 !== connectedUser.wallets.split(',')[0]) { - if (!gotOtherPeer) { - otherPeer = await getUser({ account: message.fromCAIP10, env }); - gotOtherPeer = true; + // check if message is already decrypted + if ( + // legacy messages ( no way to know if they are decrypted or not ) + message.messageObj === undefined || + // new messages ( if messageObj is string then it is not decrypted ) + typeof message.messageObj === 'string' + ) { + if (!pgpPrivateKey) { + throw Error('Decrypted private key is necessary'); + } + if (message.fromCAIP10 !== connectedUser.wallets.split(',')[0]) { + if (!gotOtherPeer) { + otherPeer = await getUser({ account: message.fromCAIP10, env }); + gotOtherPeer = true; + } + signatureValidationPubliKey = otherPeer!.publicKey; + } else { + signatureValidationPubliKey = connectedUser.publicKey; } - signatureValidationPubliKey = otherPeer!.publicKey; - } else { - signatureValidationPubliKey = connectedUser.publicKey; + messages[i] = await decryptAndVerifyMessage( + message, + signatureValidationPubliKey, + pgpPrivateKey + ); } - messages[i] = await decryptAndVerifyMessage( - message, - signatureValidationPubliKey, - pgpPrivateKey - ); } } return messages; diff --git a/packages/restapi/src/lib/chat/helpers/payloadHelper.ts b/packages/restapi/src/lib/chat/helpers/payloadHelper.ts index 3ced51cae..b322a8e00 100644 --- a/packages/restapi/src/lib/chat/helpers/payloadHelper.ts +++ b/packages/restapi/src/lib/chat/helpers/payloadHelper.ts @@ -287,7 +287,7 @@ export const groupDtoToSpaceDto = (groupDto: GroupDTO): SpaceDTO => { if (groupDto.rules) { spaceDto.rules = { - spaceAccess: groupDto.rules.groupAccess, + entry: groupDto.rules.entry, }; } @@ -296,23 +296,23 @@ export const groupDtoToSpaceDto = (groupDto: GroupDTO): SpaceDTO => { export const convertSpaceRulesToRules = (spaceRules: SpaceRules): Rules => { return { - groupAccess: spaceRules.spaceAccess, - chatAccess: undefined, + entry: spaceRules.entry, + chat: undefined, }; }; export const convertRulesToSpaceRules = (rules: Rules): SpaceRules => { return { - spaceAccess: rules.groupAccess, + entry: rules.entry, }; }; export const groupAccessToSpaceAccess = (group: GroupAccess): SpaceAccess => { const spaceAccess: SpaceAccess = { - spaceAccess: group.groupAccess, + entry: group.entry, }; - // If rules are present in the groupAccess, map them to the spaceAccess + // If rules are present in the entry, map them to the spaceAccess if (group.rules) { spaceAccess.rules = convertRulesToSpaceRules(group.rules); } diff --git a/packages/restapi/src/lib/chat/index.ts b/packages/restapi/src/lib/chat/index.ts index 54660ee0c..64512ed4b 100644 --- a/packages/restapi/src/lib/chat/index.ts +++ b/packages/restapi/src/lib/chat/index.ts @@ -21,3 +21,4 @@ export * from './removeAdmins'; export * from './getGroupAccess'; export * from './searchGroups'; export * from './rejectRequest'; +export * from './getGroupMemberStatus'; diff --git a/packages/restapi/src/lib/chat/rejectRequest.ts b/packages/restapi/src/lib/chat/rejectRequest.ts index 05bf8226f..57c884e3d 100644 --- a/packages/restapi/src/lib/chat/rejectRequest.ts +++ b/packages/restapi/src/lib/chat/rejectRequest.ts @@ -80,7 +80,7 @@ export const reject = async ( signature ); - axios + return axios .put(apiEndpoint, body) .then((response) => { return response.data; diff --git a/packages/restapi/src/lib/chat/send.ts b/packages/restapi/src/lib/chat/send.ts index bbf8a542d..674c85b52 100644 --- a/packages/restapi/src/lib/chat/send.ts +++ b/packages/restapi/src/lib/chat/send.ts @@ -13,16 +13,8 @@ import { import { conversationHash } from './conversationHash'; import { ISendMessagePayload, sendMessagePayloadCore } from './helpers'; import { getGroup } from './getGroup'; -import { - MessageObj, - REACTION_SYMBOL, - ReactionMessage, -} from '../types/messageTypes'; -import { - messageObjSchema, - metaMessageObjSchema, - reationMessageObjSchema, -} from '../validations/messageObject'; +import { MessageObj } from '../types/messageTypes'; +import { validateMessageObj } from '../validations/messageObject'; /** * SENDS A PUSH CHAT MESSAGE @@ -63,14 +55,18 @@ export const sendCore = async ( }) : null; - // OVERRIDE CONTENT FOR REACTION MESSAGE - if (messageType === MessageType.REACTION) { - messageObj.content = - REACTION_SYMBOL[(messageObj as Omit<ReactionMessage, 'type'>).action]; + // Not supported by legacy sdk versions, need to override messageContent to avoid parsing errors on legacy sdk versions + let messageContent: string; + if ( + messageType === MessageType.REPLY || + messageType === MessageType.COMPOSITE + ) { + messageContent = + 'MessageType Not Supported by this sdk version. Plz upgrade !!!'; + } else { + messageContent = messageObj.content as string; } - const messageContent = messageObj.content; // provide backward compatibility & override deprecated field - const conversationResponse = await conversationHash({ conversationId: receiver, account: sender.did, @@ -148,36 +144,7 @@ const validateOptions = async (options: ComputedOptionsType) => { } } - if ( - messageType === MessageType.TEXT || - messageType === MessageType.IMAGE || - messageType === MessageType.FILE || - messageType === MessageType.MEDIA_EMBED || - messageType === MessageType.GIF - ) { - const { error } = messageObjSchema.validate(messageObj); - if (error) { - throw new Error( - `Unable to parse this messageType. Please ensure 'messageObj' is properly defined.` - ); - } - } - - if (messageType === MessageType.META) { - const { error } = metaMessageObjSchema.validate(messageObj); - if (error) { - throw new Error( - `Unable to parse this messageType. Please ensure 'messageObj' is properly defined.` - ); - } - } else if (messageType === MessageType.REACTION) { - const { error } = reationMessageObjSchema.validate(messageObj); - if (error) { - throw new Error( - `Unable to parse this messageType. Please ensure 'messageObj' is properly defined.` - ); - } - } + validateMessageObj(messageObj, messageType); }; const computeOptions = (options: ChatSendOptionsType): ComputedOptionsType => { @@ -213,6 +180,36 @@ const computeOptions = (options: ChatSendOptionsType): ComputedOptionsType => { messageObj = rest; } + // Parse Reply Message + if (messageType === MessageType.REPLY) { + if (typeof messageObj.content === 'object') { + const { type, ...rest } = messageObj.content; + messageObj.content = { + messageType: type, + messageObj: rest, + }; + } else { + throw new Error('Options.message is not properly defined for Reply'); + } + } + + // Parse Composite Message + if (messageType === MessageType.COMPOSITE) { + if (messageObj.content instanceof Array) { + messageObj.content = messageObj.content.map( + (obj: { type: string; content: string }) => { + const { type, ...rest } = obj; + return { + messageType: type, + messageObj: rest, + }; + } + ); + } else { + throw new Error('Options.message is not properly defined for Composite'); + } + } + const account = options.account !== undefined ? options.account : null; const to = options.to !== undefined ? options.to : options.receiverAddress; diff --git a/packages/restapi/src/lib/config.ts b/packages/restapi/src/lib/config.ts index c4ed49fb2..36f9e6ddc 100644 --- a/packages/restapi/src/lib/config.ts +++ b/packages/restapi/src/lib/config.ts @@ -1,5 +1,19 @@ import Constants from './constants'; - +import { coreABI } from './abis/core'; +import { commABI } from './abis/comm'; +import { tokenABI } from './abis/token'; +import { + mainnet, + goerli, + polygon, + polygonMumbai, + bsc, + bscTestnet, + optimism, + optimismGoerli, + polygonZkEvm, + polygonZkEvmTestnet, +} from 'viem/chains'; const { ENV } = Constants; // for methods not needing the entire config @@ -25,10 +39,18 @@ const BLOCKCHAIN_NETWORK = { OPTIMISM_MAINNET: 'eip155:10', POLYGON_ZK_EVM_TESTNET: 'eip155:1442', POLYGON_ZK_EVM_MAINNET: 'eip155:1101', + ARBITRUM_TESTNET: 'eip155:421613', + ARBITRUMONE_MAINNET: "eip155:42161" }; -export type ALIAS_CHAIN = 'POLYGON' | 'BSC' | 'OPTIMISM' | 'POLYGONZKEVM'; +export type ALIAS_CHAIN = 'POLYGON' | 'BSC' | 'OPTIMISM' | 'POLYGONZKEVM' | "ARBITRUMONE"; +export const ETH_CHAIN_ID = { + [ENV.PROD]: 1, + [ENV.STAGING]: 5, + [ENV.DEV]: 5, + [ENV.LOCAL]: 5, +}; export const ALIAS_CHAIN_ID = { POLYGON: { [ENV.PROD]: 137, @@ -52,15 +74,86 @@ export const ALIAS_CHAIN_ID = { [ENV.PROD]: 1101, [ENV.STAGING]: 1442, [ENV.DEV]: 1442, - [ENV.LOCAL]: 420, + [ENV.LOCAL]: 1442, }, + ARBITRUMONE: { + [ENV.PROD]: 42161, + [ENV.STAGING]: 421613, + [ENV.DEV]: 421613, + [ENV.LOCAL]: 421613, + } +}; + +export const CHAIN_ID = { + ETHEREUM: ETH_CHAIN_ID, + ...ALIAS_CHAIN_ID, }; +export const CHAIN_NAME: { [key: number]: string } = { + // eth + 1: 'ETHEREUM', + 5: 'ETHEREUM', + // polygon + 137: 'POLYGON', + 80001: 'POLYGON', + // bsc + 56: 'BSC', + 97: 'BSC', + // optimism + 10: 'OPTIMISM', + 420: 'OPTIMISM', + // plygonzkevm + 1101: 'POLYGONZKEVM', + 1442: 'POLYGONZKEVM', +}; export interface ConfigType { API_BASE_URL: string; EPNS_COMMUNICATOR_CONTRACT: string; } + +export const VIEM_CORE_CONFIG = { + [ENV.PROD]: { + NETWORK: mainnet, + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_CORE_CONTRACT: '0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE', + }, + [ENV.STAGING]: { + NETWORK: goerli, + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_CORE_CONTRACT: '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C', + }, + [ENV.DEV]: { + NETWORK: goerli, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_CORE_CONTRACT: '0x23346B732d56d34EC4e890419fBFB8548216a799', + }, + [ENV.LOCAL]: { + NETWORK: goerli, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_CORE_CONTRACT: '0x23346B732d56d34EC4e890419fBFB8548216a799', + }, +}; + +export const CORE_CONFIG = { + [ENV.PROD]: { + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_CORE_CONTRACT: '0x66329Fdd4042928BfCAB60b179e1538D56eeeeeE', + }, + [ENV.STAGING]: { + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_CORE_CONTRACT: '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C', + }, + [ENV.DEV]: { + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_CORE_CONTRACT: '0x23346B732d56d34EC4e890419fBFB8548216a799', + }, + [ENV.LOCAL]: { + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_CORE_CONTRACT: '0x23346B732d56d34EC4e890419fBFB8548216a799', + }, +}; + const CONFIG = { [ENV.PROD]: { [BLOCKCHAIN_NETWORK.ETH_MAINNET]: { @@ -83,6 +176,10 @@ const CONFIG = { API_BASE_URL: API_BASE_URL[ENV.PROD], EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, + [BLOCKCHAIN_NETWORK.ARBITRUMONE_MAINNET]: { + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, }, [ENV.STAGING]: { [BLOCKCHAIN_NETWORK.ETH_GOERLI]: { @@ -105,6 +202,10 @@ const CONFIG = { API_BASE_URL: API_BASE_URL[ENV.STAGING], EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', }, + [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, }, [ENV.DEV]: { [BLOCKCHAIN_NETWORK.ETH_GOERLI]: { @@ -127,6 +228,10 @@ const CONFIG = { API_BASE_URL: API_BASE_URL[ENV.DEV], EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', }, + [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850', + }, }, [ENV.LOCAL]: { [BLOCKCHAIN_NETWORK.ETH_GOERLI]: { @@ -149,7 +254,153 @@ const CONFIG = { API_BASE_URL: API_BASE_URL[ENV.DEV], EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', }, + [BLOCKCHAIN_NETWORK.ARBITRUM_TESTNET]: { + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0x2f6aE0907116A2c50D712e78b48D874fadeB6850', + }, }, }; export default CONFIG; +export const TOKEN = { + [ENV.PROD]: '0xf418588522d5dd018b425E472991E52EBBeEEEEE', + [ENV.STAGING]: '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + [ENV.DEV]: '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + [ENV.LOCAL]: '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', +}; + +export const TOKEN_VIEM_NETWORK_MAP = { + [ENV.PROD]: mainnet, + [ENV.STAGING]: goerli, + [ENV.DEV]: goerli, + [ENV.LOCAL]: goerli, +} + +export const MIN_TOKEN_BALANCE = { + [ENV.PROD]: 50, + [ENV.STAGING]: 50, + [ENV.DEV]: 50, + [ENV.LOCAL]: 50, +}; +export const ABIS = { + CORE: coreABI, + COMM: commABI, + TOKEN: tokenABI, +}; + +export const CHANNEL_TYPE = { + TIMEBOUND: 4, + GENERAL: 2, +}; + + +export const VIEM_CONFIG = { + [ENV.PROD]: { + [BLOCKCHAIN_NETWORK.ETH_MAINNET]: { + NETWORK: mainnet, + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.POLYGON_MAINNET]: { + NETWORK: polygon, + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.BSC_MAINNET]: { + NETWORK: bsc, + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.OPTIMISM_MAINNET]: { + NETWORK: optimism, + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_MAINNET]: { + NETWORK: polygonZkEvm, + API_BASE_URL: API_BASE_URL[ENV.PROD], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + }, + [ENV.STAGING]: { + [BLOCKCHAIN_NETWORK.ETH_GOERLI]: { + NETWORK: goerli, + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.POLYGON_MUMBAI]: { + NETWORK: polygonMumbai, + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.BSC_TESTNET]: { + NETWORK: bscTestnet, + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.OPTIMISM_TESTNET]: { + NETWORK: optimismGoerli, + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { + NETWORK: polygonZkEvmTestnet, + API_BASE_URL: API_BASE_URL[ENV.STAGING], + EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa', + }, + }, + [ENV.DEV]: { + [BLOCKCHAIN_NETWORK.ETH_GOERLI]: { + NETWORK: goerli, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0', + }, + [BLOCKCHAIN_NETWORK.POLYGON_MUMBAI]: { + NETWORK: polygonMumbai, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504', + }, + [BLOCKCHAIN_NETWORK.BSC_TESTNET]: { + NETWORK: bscTestnet, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8', + }, + [BLOCKCHAIN_NETWORK.OPTIMISM_TESTNET]: { + NETWORK: optimismGoerli, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6', + }, + [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { + NETWORK: polygonZkEvmTestnet, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', + }, + }, + [ENV.LOCAL]: { + [BLOCKCHAIN_NETWORK.ETH_GOERLI]: { + NETWORK: goerli, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0xc064F30bac07e84500c97A04D21a9d1bfFC72Ec0', + }, + [BLOCKCHAIN_NETWORK.POLYGON_MUMBAI]: { + NETWORK: polygonMumbai, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0xAf55BE8e6b0d6107891bA76eADeEa032ef8A4504', + }, + [BLOCKCHAIN_NETWORK.BSC_TESTNET]: { + NETWORK: bscTestnet, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0x4132061E3349ff36cFfCadA460E10Bd4f31F7ea8', + }, + [BLOCKCHAIN_NETWORK.OPTIMISM_TESTNET]: { + NETWORK: optimismGoerli, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0x4305D572F2bf38Fc2AE8D0172055b1EFd18F57a6', + }, + [BLOCKCHAIN_NETWORK.POLYGON_ZK_EVM_TESTNET]: { + NETWORK: polygonZkEvmTestnet, + API_BASE_URL: API_BASE_URL[ENV.DEV], + EPNS_COMMUNICATOR_CONTRACT: '0x630b152e4185c63D7177c656b56b26f878C61572', + }, + }, +}; diff --git a/packages/restapi/src/lib/constants.ts b/packages/restapi/src/lib/constants.ts index 4735b547a..94d46f3d4 100644 --- a/packages/restapi/src/lib/constants.ts +++ b/packages/restapi/src/lib/constants.ts @@ -27,21 +27,20 @@ export enum ENCRYPTION_TYPE { export enum MessageType { TEXT = 'Text', IMAGE = 'Image', + VIDEO = 'Video', + AUDIO = 'Audio', FILE = 'File', + /** @deprecated - Use `MediaEmbed` Instead */ + GIF = 'GIF', MEDIA_EMBED = 'MediaEmbed', META = 'Meta', REACTION = 'Reaction', - /** - * @deprecated - Use MediaEmbed Instead - */ - GIF = 'GIF', - - // TODO - // AUDIO = 'Audio', - // VIDEO = 'Video', - // PAYMENT = 'Payment', - // REPLY = 'Reply', - // COMPOSITE = 'Composite', + RECEIPT = 'Receipt', + USER_ACTIVITY = 'UserActivity', + INTENT = 'Intent', + REPLY = 'Reply', + COMPOSITE = 'Composite', + PAYMENT = 'Payment', } const Constants = { @@ -55,7 +54,7 @@ const Constants = { }, DEFAULT_CHAIN_ID: 5, DEV_CHAIN_ID: 99999, - NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101], + NON_ETH_CHAINS: [137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161], ETH_CHAINS: [1, 5], ENC_TYPE_V1: 'x25519-xsalsa20-poly1305', ENC_TYPE_V2: 'aes256GcmHkdfSha256', diff --git a/packages/restapi/src/lib/index.ts b/packages/restapi/src/lib/index.ts index cd3f53dbd..cbb11f040 100644 --- a/packages/restapi/src/lib/index.ts +++ b/packages/restapi/src/lib/index.ts @@ -9,7 +9,6 @@ import * as video from "./video" export * from './types'; export { PushAPI } from './pushapi/PushAPI'; - export { alias, channels, diff --git a/packages/restapi/src/lib/payloads/constants.ts b/packages/restapi/src/lib/payloads/constants.ts index a3c5d9a41..da01fafc7 100644 --- a/packages/restapi/src/lib/payloads/constants.ts +++ b/packages/restapi/src/lib/payloads/constants.ts @@ -13,6 +13,8 @@ export const CHAIN_ID_TO_SOURCE: ChainIdToSourceType = { 420: 'OPTIMISM_TESTNET', 1442: 'POLYGON_ZK_EVM_TESTNET', 1101: 'POLYGON_ZK_EVM_MAINNET', + 421613: "ARBITRUM_TESTNET", + 42161: "ARBITRUMONE_MAINNET" }; export const SOURCE_TYPES = { @@ -26,6 +28,8 @@ export const SOURCE_TYPES = { OPTIMISM_TESTNET: 'OPTIMISM_TESTNET', POLYGON_ZK_EVM_TESTNET: 'POLYGON_ZK_EVM_TESTNET', POLYGON_ZK_EVM_MAINNET: 'POLYGON_ZK_EVM_MAINNET', + ARBITRUM_TESTNET: "ARBITRUM_TESTNET", + ARBITRUMONE_MAINNET: "ARBITRUMONE_MAINNET", THE_GRAPH: 'THE_GRAPH', PUSH_VIDEO: 'PUSH_VIDEO', }; diff --git a/packages/restapi/src/lib/payloads/helpers.ts b/packages/restapi/src/lib/payloads/helpers.ts index 6b7016feb..0ef67d4f2 100644 --- a/packages/restapi/src/lib/payloads/helpers.ts +++ b/packages/restapi/src/lib/payloads/helpers.ts @@ -67,6 +67,9 @@ export function getPayloadForAPIInput( ...(inputOptions?.payload?.additionalMeta && { additionalMeta: inputOptions?.payload?.additionalMeta, }), + ...(inputOptions?.payload?.index && { + index: inputOptions?.payload?.index, + }), }, recipients: recipients, }; @@ -321,7 +324,7 @@ export function getSource( export function getCAIPFormat(chainId: number, address: string) { // EVM based chains - if ([1, 5, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101].includes(chainId)) { + if ([1, 5, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101, 421613, 42161].includes(chainId)) { return `eip155:${chainId}:${address}`; } diff --git a/packages/restapi/src/lib/progressHook.ts b/packages/restapi/src/lib/progressHook.ts index 0309c5618..64b6556b6 100644 --- a/packages/restapi/src/lib/progressHook.ts +++ b/packages/restapi/src/lib/progressHook.ts @@ -176,6 +176,60 @@ const PROGRESSHOOK: Record< progressInfo: '', level: 'SUCCESS', }, + /** + * PUSH_CHANNEL_CREATE PROGRESSHOOKS + */ + 'PUSH-CHANNEL-CREATE-01': { + progressId: 'PUSH-CHANNEL-CREATE-01', + progressTitle: 'Uploading data to IPFS', + progressInfo: 'The channel’s data is getting uploaded to IPFS', + level: 'INFO', + }, + 'PUSH-CHANNEL-CREATE-02': { + progressId: 'PUSH-CHANNEL-CREATE-02', + progressTitle: 'Approving PUSH tokens', + progressInfo: 'Gives approval to Push Core contract to spend 50 DAI', + level: 'INFO', + }, + 'PUSH-CHANNEL-CREATE-03': { + progressId: 'PUSH-CHANNEL-CREATE-03', + progressTitle: 'Channel is getting created', + progressInfo: 'Calls Push Core contract to create your channel', + level: 'INFO', + }, + 'PUSH-CHANNEL-CREATE-04': { + progressId: 'PUSH-CHANNEL-CREATE-04', + progressTitle: 'Channel creation is done, Welcome to Push Ecosystem', + progressInfo: 'Channel creation is completed', + level: 'SUCCESS', + }, + /** + * PUSH_CHANNEL_UPDATE PROGRESSHOOKS + */ + 'PUSH-CHANNEL-UPDATE-01': { + progressId: 'PUSH-CHANNEL-UPDATE-01', + progressTitle: 'Uploading new data to IPFS', + progressInfo: 'The channel’s new data is getting uploaded to IPFS', + level: 'INFO', + }, + 'PUSH-CHANNEL-UPDATE-02': { + progressId: 'PUSH-CHANNEL-UPDATE-02', + progressTitle: 'Approving PUSH tokens', + progressInfo: 'Gives approval to Push Core contract to spend 50 DAI', + level: 'INFO', + }, + 'PUSH-CHANNEL-UPDATE-03': { + progressId: 'PUSH-CHANNEL-UPDATE-03', + progressTitle: 'Channel is getting updated', + progressInfo: 'Calls Push Core contract to update your channel details', + level: 'INFO', + }, + 'PUSH-CHANNEL-UPDATE-04': { + progressId: 'PUSH-CHANNEL-UPDATE-04', + progressTitle: 'Channel is updated with new data', + progressInfo: 'Channel is successfully updated', + level: 'SUCCESS', + }, /** * PUSH-ERROR PROGRESSHOOKS */ @@ -195,5 +249,13 @@ const PROGRESSHOOK: Record< level: 'WARN', }; }, + 'PUSH-ERROR-02': (name: string, err: string) => { + return { + progressId: 'PUSH-ERROR-02', + progressTitle: 'Transaction failed', + progressInfo: `[Push SDK] - Contract - Error - ${name} -: ${err}`, + level: 'ERROR', + }; + }, }; export default PROGRESSHOOK; diff --git a/packages/restapi/src/lib/pushNotification/PushNotificationTypes.ts b/packages/restapi/src/lib/pushNotification/PushNotificationTypes.ts new file mode 100644 index 000000000..a4ac86d79 --- /dev/null +++ b/packages/restapi/src/lib/pushNotification/PushNotificationTypes.ts @@ -0,0 +1,114 @@ +import { ProgressHookType } from '../types'; +import { GetAliasInfoOptionsType } from '../alias'; +import { ADDITIONAL_META_TYPE } from '../../lib/payloads/constants'; + +export type SubscriptionOptions = { + account?: string; + page?: number; + limit?: number; +}; +export type ChannelInfoOptions = { + channel?: string; +}; + +export type SubscribeUnsubscribeOptions = { + onSuccess?: () => void; + onError?: (err: Error) => void; + settings?: UserSetting[]; +}; + +export type UserSetting = { + enabled: boolean; + value?: number; +}; + +export type AliasOptions = Omit<GetAliasInfoOptionsType, 'env'>; + +export enum FeedType { + INBOX = 'INBOX', + SPAM = 'SPAM', +} + +export type FeedsOptions = { + account?: string; + //TODO: change it to string[] once we start supporting multiple channel + channels?: [string]; + page?: number; + limit?: number; + raw?: boolean; +}; + +export type ChannelSearchOptions = { + page?: number; + limit?: number; +}; + +// Types related to notification +export type INotification = { + title: string; + body: string; +}; + +export type IPayload = { + title?: string; + body?: string; + cta?: string; + embed?: string; + index?: { + index: number; + value?: number; + }; + meta?: { + domain?: string; + type: `${ADDITIONAL_META_TYPE}+${number}`; + data: string; + }; +}; + +export type IConfig = { + expiry?: number; + silent?: boolean; + hidden?: boolean; +}; + +export type IAdvance = { + graph?: { + id: string; + counter: number; + }; + ipfs?: string; + minimal?: string; + chatid?: string; + pgpPrivateKey?: string; +}; + +export type NotificationOptions = { + notification: INotification; + payload?: IPayload; + config?: IConfig; + advanced?: IAdvance; + channel?: string; +}; + +export type CreateChannelOptions = { + name: string; + description: string; + icon: string; + url: string; + alias?: string; + progressHook?: (progress: ProgressHookType) => void; +}; + +export type NotificationSetting = { + type: number; + default: number; + description: string; + data?: { + upper: number; + lower: number; + enabled?: boolean; + ticker?: number; + }; +}; + +export type NotificationSettings = NotificationSetting[]; diff --git a/packages/restapi/src/lib/pushNotification/alias.ts b/packages/restapi/src/lib/pushNotification/alias.ts new file mode 100644 index 000000000..487d8ad20 --- /dev/null +++ b/packages/restapi/src/lib/pushNotification/alias.ts @@ -0,0 +1,25 @@ +import { ENV } from '../constants'; +import { AliasOptions } from './PushNotificationTypes'; + +import * as PUSH_ALIAS from '../alias'; + + +export class Alias { + private env: ENV + constructor(env: ENV) { + this.env = env + } + + /** + * @description - fetches alias information + * @param {AliasOptions} options - options related to alias + * @returns Alias details + */ + info = async (options: AliasOptions) => { + try { + return await PUSH_ALIAS.getAliasInfo({ ...options, env: this.env }); + } catch (error) { + throw new Error(`Push SDK Error: API : alias::info : ${error}`); + } + }; +} diff --git a/packages/restapi/src/lib/pushNotification/channel.ts b/packages/restapi/src/lib/pushNotification/channel.ts new file mode 100644 index 000000000..da57c04bb --- /dev/null +++ b/packages/restapi/src/lib/pushNotification/channel.ts @@ -0,0 +1,431 @@ +import Constants, { ENV } from '../constants'; +import { + SignerType, + ProgressHookType, + ProgressHookTypeFunction, +} from '../types'; +import { + ChannelInfoOptions, + ChannelSearchOptions, + NotificationOptions, + CreateChannelOptions, + NotificationSettings, +} from './PushNotificationTypes'; +import * as config from '../config'; +import * as PUSH_PAYLOAD from '../payloads'; +import * as PUSH_CHANNEL from '../channels'; +import { + getCAIPDetails, + validateCAIP, + getFallbackETHCAIPAddress, +} from '../helpers'; +import PROGRESSHOOK from '../progressHook'; +import { ethers } from 'ethers'; + +import { PushNotificationBaseClass } from './pushNotificationBase'; +import { Delegate } from './delegate'; +import { Alias } from './alias'; + +export class Channel extends PushNotificationBaseClass { + public delegate!: Delegate + public alias!: Alias + constructor(signer?: SignerType, env?: ENV, account?: string) { + super(signer, env, account); + this.delegate = new Delegate(signer, env, account) + this.alias = new Alias(env!); + } + + /** + * @description - returns information about a channel + * @param {string} [options.channel] - channel address in caip, defaults to eth caip address + * @returns information about the channel if it exists + */ + info = async (channel?: string) => { + try { + this.checkUserAddressExists(channel); + channel = channel ?? getFallbackETHCAIPAddress(this.env!, this.account!); + return await PUSH_CHANNEL.getChannel({ + channel: channel as string, + env: this.env, + }); + } catch (error) { + throw new Error(`Push SDK Error: API : channel::info : ${error}`); + } + }; + + /** + * @description - returns relevant information as per the query that was passed + * @param {string} query - search query + * @param {number} [options.page] - page number. default is set to Constants.PAGINATION.INITIAL_PAGE + * @param {number} [options.limit] - number of feeds per page. default is set to Constants.PAGINATION.LIMIT + * @returns Array of results relevant to the serach query + */ + search = async (query: string, options?: ChannelSearchOptions) => { + try { + const { + page = Constants.PAGINATION.INITIAL_PAGE, + limit = Constants.PAGINATION.LIMIT, + } = options || {}; + return await PUSH_CHANNEL.search({ + query: query, + page: page, + limit: limit, + env: this.env, + }); + } catch (error) { + throw new Error(`Push SDK Error: API : channel::search : ${error}`); + } + }; + /** + * @description - Get subscribers of a channell + * @param {string} [options.channel] - channel in caip. defaults to account from signer with eth caip + * @returns array of subscribers + */ + subscribers = async (options?: ChannelInfoOptions) => { + try { + const { + channel = this.account + ? getFallbackETHCAIPAddress(this.env!, this.account!) + : null, + } = options || {}; + + this.checkUserAddressExists(channel!); + if (!validateCAIP(channel!)) { + throw new Error('Invalid CAIP'); + } + return await PUSH_CHANNEL._getSubscribers({ + channel: channel!, + env: this.env, + }); + } catch (error) { + throw new Error(`Push SDK Error: API : channel::subscribers : ${error}`); + } + }; + /** + * + * @param {string[]} recipients - Array of recipients. `['0x1'] -> TARGET`, `['0x1, 0x2'] -> SUBSET`, `['*'] -> BROADCAST` + * @param {object} options - Notification options + * @returns + */ + send = async (recipients: string[], options: NotificationOptions) => { + try { + this.checkSignerObjectExists(); + const lowLevelPayload = this.generateNotificationLowLevelPayload({ + signer: this.signer!, + env: this.env!, + recipients: recipients, + options: options, + channel: options.channel ?? this.account, + }); + return await PUSH_PAYLOAD.sendNotification(lowLevelPayload); + } catch (error) { + throw new Error(`Push SDK Error: API : channel::send : ${error}`); + } + }; + + create = async (options: CreateChannelOptions) => { + const { + name, + description, + url, + icon, + alias = null, + progressHook, + } = options || {}; + try { + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + } else if ('signTypedData' in this.signer!) { + if (!this.coreContract.write) { + throw new Error('viem signer is not provided'); + } + } else { + throw new Error('Unsupported Signer'); + } + // create push token instance + let aliasInfo; + // validate all the parameters and length + this.validateChannelParameters(options); + // check for PUSH balance + const pushTokenContract = await this.createContractInstance( + config.TOKEN[this.env!], + config.ABIS.TOKEN, + config.TOKEN_VIEM_NETWORK_MAP[this.env!] + ); + const balance = await this.fetchBalance(pushTokenContract, this.account!); + const fees = ethers.utils.parseUnits( + config.MIN_TOKEN_BALANCE[this.env!].toString(), + 18 + ); + if (fees.gte(balance)) { + throw new Error('Insufficient PUSH balance'); + } + // if alias is passed, check for the caip + if (alias) { + if (!validateCAIP(alias)) { + throw new Error('Invalid alias CAIP'); + } + const aliasDetails = getCAIPDetails(alias); + aliasInfo = { + [`${aliasDetails?.blockchain}:${aliasDetails?.networkId}`]: + aliasDetails?.address, + }; + } + // construct channel identity + progressHook?.(PROGRESSHOOK['PUSH-CREATE-01'] as ProgressHookType); + const input = { + name: name, + info: description, + url: url, + icon: icon, + aliasDetails: aliasInfo ?? {}, + }; + const cid = await this.uploadToIPFSViaPushNode(JSON.stringify(input)); + const allowanceAmount = await this.fetchAllownace( + pushTokenContract, + this.account!, + config.CORE_CONFIG[this.env!].EPNS_CORE_CONTRACT + ); + if (!allowanceAmount.gte(fees)) { + progressHook?.(PROGRESSHOOK['PUSH-CREATE-02'] as ProgressHookType); + const approvalRes = await this.approveToken( + pushTokenContract, + config.CORE_CONFIG[this.env!].EPNS_CORE_CONTRACT, + fees + ); + if (!approvalRes) { + throw new Error('Something went wrong while approving the token'); + } + } + // generate the contract parameters + const channelType = config.CHANNEL_TYPE['GENERAL']; + const identity = '1+' + cid; + const identityBytes = ethers.utils.toUtf8Bytes(identity); + // call contract + progressHook?.(PROGRESSHOOK['PUSH-CREATE-03'] as ProgressHookType); + const createChannelRes = await this.createChannel( + this.coreContract, + channelType, + identityBytes, + fees + ); + progressHook?.(PROGRESSHOOK['PUSH-CREATE-04'] as ProgressHookType); + return { transactionHash: createChannelRes }; + } catch (error) { + const errorProgressHook = PROGRESSHOOK[ + 'PUSH-ERROR-02' + ] as ProgressHookTypeFunction; + progressHook?.(errorProgressHook('Create Channel', error)); + throw new Error( + `Push SDK Error: Contract : createChannelWithPUSH : ${error}` + ); + } + }; + + update = async (options: CreateChannelOptions) => { + const { + name, + description, + url, + icon, + alias = null, + progressHook, + } = options || {}; + try { + // create push token instance + let aliasInfo; + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + } else if ('signTypedData' in this.signer!) { + if (!this.coreContract.write) { + throw new Error('viem signer is not provided'); + } + } else { + throw new Error('Unsupported Signer'); + } + // validate all the parameters and length + this.validateChannelParameters(options); + // check for PUSH balance + const pushTokenContract = await this.createContractInstance( + config.TOKEN[this.env!], + config.ABIS.TOKEN, + config.TOKEN_VIEM_NETWORK_MAP[this.env!] + ); + const balance = await this.fetchBalance(pushTokenContract, this.account!); + // get counter + const counter = await this.fetchUpdateCounter(this.coreContract, this.account!); + const fees = ethers.utils.parseUnits( + config.MIN_TOKEN_BALANCE[this.env!].toString(), + 18 + ); + const totalFees = fees.mul(counter) + if (totalFees.gte(balance)) { + throw new Error('Insufficient PUSH balance'); + } + // if alias is passed, check for the caip + if (alias) { + if (!validateCAIP(alias)) { + throw new Error('Invalid alias CAIP'); + } + const aliasDetails = getCAIPDetails(alias); + aliasInfo = { + [`${aliasDetails?.blockchain}:${aliasDetails?.networkId}`]: + aliasDetails?.address, + }; + } + // construct channel identity + progressHook?.(PROGRESSHOOK['PUSH-UPDATE-01'] as ProgressHookType); + const input = { + name: name, + info: description, + url: url, + icon: icon, + aliasDetails: aliasInfo ?? {}, + }; + const cid = await this.uploadToIPFSViaPushNode(JSON.stringify(input)); + // approve the tokens to core contract + const allowanceAmount = await this.fetchAllownace( + pushTokenContract, + this.account!, + config.CORE_CONFIG[this.env!].EPNS_CORE_CONTRACT + ); + // if allowance is not greater than the fees, dont call approval again + if (!allowanceAmount.gte(totalFees)) { + progressHook?.(PROGRESSHOOK['PUSH-UPDATE-02'] as ProgressHookType); + const approvalRes = await this.approveToken( + pushTokenContract, + config.CORE_CONFIG[this.env!].EPNS_CORE_CONTRACT, + totalFees + ); + if (!approvalRes) { + throw new Error('Something went wrong while approving the token'); + } + } + // generate the contract parameters + const identity = '1+' + cid; + const identityBytes = ethers.utils.toUtf8Bytes(identity); + // call contract + progressHook?.(PROGRESSHOOK['PUSH-UPDATE-03'] as ProgressHookType); + const updateChannelRes = await this.updateChannel( + this.coreContract, + this.account!, + identityBytes, + totalFees + ); + progressHook?.(PROGRESSHOOK['PUSH-UPDATE-04'] as ProgressHookType); + return { transactionHash: updateChannelRes }; + } catch (error) { + const errorProgressHook = PROGRESSHOOK[ + 'PUSH-ERROR-02' + ] as ProgressHookTypeFunction; + progressHook?.(errorProgressHook('Update Channel', error)); + throw new Error(`Push SDK Error: Contract channel::update : ${error}`); + } + }; + /** + * @description verifies a channel + * @param {string} channelToBeVerified - address of the channel to be verified + * @returns the transaction hash if the transaction is successful + */ + verify = async (channelToBeVerified: string) => { + try { + this.checkSignerObjectExists(); + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + } else if ('signTypedData' in this.signer!) { + if (!this.coreContract.write) { + throw new Error('viem signer is not provided'); + } + } else { + throw new Error('Unsupported Signer'); + } + if (validateCAIP(channelToBeVerified)) { + channelToBeVerified = channelToBeVerified.split(':')[2]; + } + // checks if it is a valid address + if (!ethers.utils.isAddress(channelToBeVerified)) { + throw new Error('Invalid channel address'); + } + const channelDetails = await this.info(this.account); + if(channelDetails?.verified_status == 0){ + throw new Error("Only verified channel can verify other channel") + } + // if valid, continue with it + const res = await this.verifyChannel( + this.coreContract, + channelToBeVerified + ); + if (!res) { + throw new Error('Something went wrong while verifying the channel'); + } + return { transactionHash: res }; + } catch (error) { + throw new Error(`Push SDK Error: Contract channel::verify : ${error}`); + } + }; + + setting = async (configuration: NotificationSettings) => { + try { + this.checkSignerObjectExists(); + //TODO: create a separate function later + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + } else if ('signTypedData' in this.signer!) { + if (!this.coreContract.write) { + throw new Error('viem signer is not provided'); + } + } else { + throw new Error('Unsupported Signer'); + } + // check for PUSH balance + const pushTokenContract = await this.createContractInstance( + config.TOKEN[this.env!], + config.ABIS.TOKEN, + config.TOKEN_VIEM_NETWORK_MAP[this.env!] + ); + const balance = await this.fetchBalance(pushTokenContract, this.account!); + const fees = ethers.utils.parseUnits( + config.MIN_TOKEN_BALANCE[this.env!].toString(), + 18 + ); + if (fees.gte(balance)) { + throw new Error('Insufficient PUSH balance'); + } + const allowanceAmount = await this.fetchAllownace( + pushTokenContract, + this.account!, + config.CORE_CONFIG[this.env!].EPNS_CORE_CONTRACT + ); + // if allowance is not greater than the fees, dont call approval again + if (!allowanceAmount.gte(fees)) { + const approveRes = await this.approveToken( + pushTokenContract, + config.CORE_CONFIG[this.env!].EPNS_CORE_CONTRACT, + fees + ); + if (!approveRes) { + throw new Error('Something went wrong while approving your token'); + } + } + const { setting, description } = this.getMinimalSetting(configuration); + const createSettingsRes = await this.createChanelSettings( + this.coreContract, + configuration.length, + setting, + description, + fees + ); + return { transactionHash: createSettingsRes }; + } catch (error) { + throw new Error(`Push SDK Error: Contract : channel::setting : ${error}`); + } + }; +} diff --git a/packages/restapi/src/lib/pushNotification/delegate.ts b/packages/restapi/src/lib/pushNotification/delegate.ts new file mode 100644 index 000000000..3d08bcd3a --- /dev/null +++ b/packages/restapi/src/lib/pushNotification/delegate.ts @@ -0,0 +1,112 @@ +import { ENV } from '../constants'; +import { SignerType } from '../types'; +import { ChannelInfoOptions } from './PushNotificationTypes'; +import CONFIG, * as config from '../config'; +import * as PUSH_CHANNEL from '../channels'; +import { validateCAIP, getFallbackETHCAIPAddress } from '../helpers'; +import { PushNotificationBaseClass } from './pushNotificationBase'; + +export class Delegate extends PushNotificationBaseClass { + constructor(signer?: SignerType, env?: ENV, account?: string) { + super(signer, env, account); + } + + /** + * @description - Get delegates of a channell + * @param {string} [options.channel] - channel in caip. defaults to account from signer with eth caip + * @returns array of delegates + */ + get = async (options?: ChannelInfoOptions) => { + try { + const { + channel = this.account + ? getFallbackETHCAIPAddress(this.env!, this.account!) + : null, + } = options || {}; + this.checkUserAddressExists(channel!); + if (!validateCAIP(channel!)) { + throw new Error('Invalid CAIP'); + } + return await PUSH_CHANNEL.getDelegates({ + channel: channel!, + env: this.env, + }); + } catch (error) { + throw new Error(`Push SDK Error: API : delegate::get : ${error}`); + } + }; + + /** + * @description adds a delegate + * @param {string} delegate - delegate address in caip to be added + * @returns the transaction hash if the transaction is successfull + */ + add = async (delegate: string) => { + try { + if (!validateCAIP(delegate)) { + throw new Error('Invalid CAIP'); + } + + const networkDetails = await this.getChianId(this.signer!); + if (networkDetails !== parseInt(delegate.split(':')[1])) { + return new Error('Signer and CAIP chain id doesnt match'); + } + const caip = `eip155:${networkDetails}`; + if (!CONFIG[this.env!][caip] || !config.VIEM_CONFIG[this.env!][caip]) { + throw new Error('Unsupported Chainid'); + } + const commAddress = CONFIG[this.env!][caip].EPNS_COMMUNICATOR_CONTRACT; + const commContract = this.createContractInstance( + commAddress, + config.ABIS.COMM, + config.VIEM_CONFIG[this.env!][caip].NETWORK + ); + const addDelegateRes = await this.addDelegator( + commContract, + delegate.split(':')[2] + ); + return { transactionHash: addDelegateRes }; + } catch (error) { + throw new Error(`Push SDK Error: Contract : delegate::add : ${error}`); + } + }; + + /** + * @description removes a delegate + * @param {string} delegate - caip address of the delegate to be removed + * @returns the transaction hash if the transaction is successfull + */ + remove = async (delegate: string) => { + try { + this.checkSignerObjectExists(); + if (this.signer && !this.signer.provider) { + throw new Error('Provider is required'); + } + if (!validateCAIP(delegate)) { + throw new Error('Invalid CAIP'); + } + + const networkDetails = await this.getChianId(this.signer!); + if (networkDetails !== parseInt(delegate.split(':')[1])) { + return new Error('Signer and CAIP chain id doesnt match'); + } + const caip = `eip155:${networkDetails}`; + if (!CONFIG[this.env!][caip] || !config.VIEM_CONFIG[this.env!][caip]) { + throw new Error('Unsupported Chainid'); + } + const commAddress = CONFIG[this.env!][caip].EPNS_COMMUNICATOR_CONTRACT; + const commContract = this.createContractInstance( + commAddress, + config.ABIS.COMM, + config.VIEM_CONFIG[this.env!][caip].NETWORK + ); + const removeDelegateRes = await this.removeDelegator( + commContract, + delegate.split(':')[2] + ); + return { transactionHash: removeDelegateRes }; + } catch (error) { + throw new Error(`Push SDK Error: Contract : delegate::remove : ${error}`); + } + }; +} diff --git a/packages/restapi/src/lib/pushNotification/notification.ts b/packages/restapi/src/lib/pushNotification/notification.ts new file mode 100644 index 000000000..ebd7ade15 --- /dev/null +++ b/packages/restapi/src/lib/pushNotification/notification.ts @@ -0,0 +1,206 @@ +import Constants, { ENV } from '../constants'; +import { SignerType } from '../types'; +import { + SubscribeUnsubscribeOptions, + SubscriptionOptions, + FeedType, + FeedsOptions, +} from './PushNotificationTypes'; +import * as PUSH_USER from '../user'; +import * as PUSH_CHANNEL from '../channels'; + +import { + getCAIPDetails, + getCAIPWithChainId, + validateCAIP, + getFallbackETHCAIPAddress, +} from '../helpers'; +import PROGRESSHOOK from '../progressHook'; +import { ethers } from 'ethers'; + +import { PushNotificationBaseClass } from './pushNotificationBase'; +// ERROR CONSTANTS +const ERROR_CHANNEL_NEEDED = 'Channel is needed'; +const ERROR_INVALID_CAIP = 'Invalid CAIP format'; + +export const FEED_MAP = { + INBOX: false, + SPAM: true, +}; +export class Notification extends PushNotificationBaseClass { + constructor(signer?: SignerType, env?: ENV, account?: string) { + super(signer, env, account); + } + + /** + * @description - Fetches feeds and spam feeds for a specific user + * @param {enums} spam - indicates if its a spam or not. `INBOX` for non-spam and `SPAM` for spam. default `INBOX` + * @param {string} [options.user] - user address, defaults to address from signer + * @param {number} [options.page] - page number. default is set to Constants.PAGINATION.INITIAL_PAGE + * @param {number} [options.limit] - number of feeds per page. default is set to Constants.PAGINATION.LIMIT + * @param {boolean} [options.raw] - indicates if the response should be raw or formatted. defaults is set to false + * @returns feeds for a specific address + */ + list = async ( + spam: `${FeedType}` = FeedType.INBOX, + options?: FeedsOptions + ) => { + const { + account = this.account + ? getFallbackETHCAIPAddress(this.env!, this.account!) + : null, + page = Constants.PAGINATION.INITIAL_PAGE, + limit = Constants.PAGINATION.LIMIT, + channels = [], + raw = false, + } = options || {}; + try { + // guest mode and valid address check + this.checkUserAddressExists(account!); + if (!validateCAIP(account!)) { + throw new Error('Invalid CAIP'); + } + const nonCaipAccount = + account?.split(':')[account?.split(':').length - 1]; + if (channels.length == 0) { + // else return the response + return await PUSH_USER.getFeeds({ + user: nonCaipAccount!, + page: page, + limit: limit, + spam: FEED_MAP[spam], + raw: raw, + env: this.env, + }); + } else { + return await PUSH_USER.getFeedsPerChannel({ + user: nonCaipAccount!, + page: page, + limit: limit, + spam: FEED_MAP[spam], + raw: raw, + env: this.env, + channels: channels, + }); + } + } catch (error) { + throw new Error(`Push SDK Error: API : notifcaiton::list : ${error}`); + } + }; + + subscriptions = async (options?: SubscriptionOptions) => { + try { + const { + account = this.account, + // TODO: to be used once pagination is implemeted at API level + page = Constants.PAGINATION.INITIAL_PAGE, + limit = Constants.PAGINATION.LIMIT, + } = options || {}; + this.checkUserAddressExists(account!); + return await PUSH_USER.getSubscriptions({ + user: account!, + env: this.env, + }); + } catch (error) { + throw new Error( + `Push SDK Error: API : notifcaiton::subscriptions : ${error}` + ); + } + }; + /** + * Subscribes a user to a channel + * @param {string} channel - channel address in caip format + * @param {function} [options.onSuccess] - callback function when a user successfully subscribes to a channel + * @param {function} [options.onError] - callback function incase a user was not able to subscribe to a channel + * @returns Subscribe status object + */ + subscribe = async ( + channel: string, + options?: SubscribeUnsubscribeOptions + ) => { + try { + const { onSuccess, onError, settings } = options || {}; + // Vaidatiions + // validates if signer object is present + this.checkSignerObjectExists(); + // validates if the user address exists + this.checkUserAddressExists(); + // validates if channel exists + if (!channel && channel != '') { + throw new Error(ERROR_CHANNEL_NEEDED); + } + // validates if caip is correct + if (!validateCAIP(channel)) { + throw new Error(ERROR_INVALID_CAIP); + } + // get channel caip + const caipDetail = getCAIPDetails(channel); + // based on the caip, construct the user caip + const userAddressInCaip = getCAIPWithChainId( + this.account!, + parseInt(caipDetail?.networkId as string) + ); + // convert the setting to minimal version + const minimalSetting = this.getMinimalUserSetting(settings!); + return await PUSH_CHANNEL.subscribeV2({ + signer: this.signer!, + channelAddress: channel, + userAddress: userAddressInCaip, + env: this.env, + settings: minimalSetting ?? '', + onSuccess: onSuccess, + onError: onError, + }); + } catch (error) { + throw new Error( + `Push SDK Error: API : notifcaiton::subscribe : ${error}` + ); + } + }; + + /** + * Unsubscribes a user to a channel + * @param {string} channel - channel address in caip format + * @param {function} [options.onSuccess] - callback function when a user successfully unsubscribes to a channel + * @param {function} [options.onError] - callback function incase a user was not able to unsubscribe to a channel + * @returns Unsubscribe status object + */ + unsubscribe = async ( + channel: string, + options?: SubscribeUnsubscribeOptions + ) => { + try { + const { onSuccess, onError } = options || {}; + // Vaidatiions + // validates if the user address exists + this.checkUserAddressExists(); + // validates if signer object is present + this.checkSignerObjectExists(); + // validates if channel exists + if (!channel && channel != '') { + return new Error(ERROR_CHANNEL_NEEDED); + } + // validates if caip is correct + if (!validateCAIP(channel)) { + return new Error(ERROR_INVALID_CAIP); + } + const caipDetail = getCAIPDetails(channel); + const userAddressInCaip = getCAIPWithChainId( + this.account!, + parseInt(caipDetail?.networkId as string) + ); + return await PUSH_CHANNEL.unsubscribeV2({ + signer: this.signer!, + channelAddress: channel, + userAddress: userAddressInCaip, + env: this.env, + onSuccess: onSuccess, + onError: onError, + }); + } catch (error) { + throw new Error( + `Push SDK Error: API : notifcaiton::unsubscribe : ${error}` + ); + } + }; +} diff --git a/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts b/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts new file mode 100644 index 000000000..760057fd4 --- /dev/null +++ b/packages/restapi/src/lib/pushNotification/pushNotificationBase.ts @@ -0,0 +1,739 @@ +import { ENV } from '../constants'; +import { SignerType, ISendNotificationInputOptions } from '../types'; +import { + NotificationOptions, + CreateChannelOptions, + NotificationSettings, + UserSetting, +} from './PushNotificationTypes'; +import CONFIG, * as config from '../config'; +import { getAccountAddress } from '../chat/helpers'; +import { IDENTITY_TYPE, NOTIFICATION_TYPE } from '../payloads/constants'; +import { ethers, Signer, BigNumber } from 'ethers'; +import axios from 'axios'; +import { + createPublicClient, + http, + getContract, + WalletClient, + Chain, +} from 'viem'; + +// ERROR CONSTANTS +const ERROR_ACCOUNT_NEEDED = 'Account is required'; +const ERROR_SIGNER_NEEDED = 'Signer object is required'; + +const BROADCAST_TYPE = '*'; +const LENGTH_UPPER_LIMIT = 125; +const LENGTH_LOWER_LIMTI = 1; +const SETTING_DELIMITER = '-'; +const SETTING_SEPARATOR = '+'; +const SLIDER_TYPE = 2; +const BOOLEAN_TYPE = 1; +const DEFAULT_ENABLE_VALUE = '1'; +const DEFAULT_TICKER_VALUE = '1'; + +export const FEED_MAP = { + INBOX: false, + SPAM: true, +}; +export class PushNotificationBaseClass { + protected signer: SignerType | undefined; + protected account: string | undefined; + protected env: ENV | undefined; + protected guestMode: boolean; + protected coreContract: any; + + constructor(signer?: SignerType, env?: ENV, account?: string) { + this.signer = signer; + this.env = env; + this.guestMode = !!(account && signer); + this.account = account; + this.initializeCoreContract({ signer: this.signer, env: this.env }); + } + + private async initializeCoreContract(options?: { + signer?: SignerType; + env?: ENV; + }) { + const { env = ENV.STAGING, signer = null } = options || {}; + // Derives account from signer if not provided + let derivedAccount; + let coreContract; + if (signer) { + if (!('_signTypedData' in signer!) && !('signTypedData' in signer!)) { + throw new Error('Unsupported signer type'); + } else if ('_signTypedData' in signer) { + derivedAccount = await getAccountAddress({ + account: null, + signer: signer, + }); + if (signer?.provider) { + coreContract = new ethers.Contract( + config.CORE_CONFIG[env].EPNS_CORE_CONTRACT, + config.ABIS.CORE, + signer as unknown as Signer + ); + } + } else if ('signTypedData' in signer) { + derivedAccount = await getAccountAddress({ + account: null, + signer: signer, + }); + const client = createPublicClient({ + chain: config.TOKEN_VIEM_NETWORK_MAP[env], + transport: http(), + }); + coreContract = getContract({ + abi: config.ABIS.CORE, + address: config.CORE_CONFIG[env].EPNS_CORE_CONTRACT as `0x${string}`, + publicClient: client, + walletClient: signer as unknown as WalletClient, + }); + } + } + + // Initialize PushNotifications instance + this.coreContract = coreContract; + } + + // check if addresses is supplied either by user or derived from signer object or if its guest mode + protected checkUserAddressExists(user?: string) { + if (!user && !this.account && !this.guestMode) + throw new Error(ERROR_ACCOUNT_NEEDED); + return true; + } + + // checks if the signer object is supplied + protected checkSignerObjectExists() { + if (!this.signer) throw new Error(ERROR_SIGNER_NEEDED); + return true; + } + + // get type of notification from recipient + protected getNotificationType( + recipient: string[], + channel: string + ): { recipient: string[] | string; type: number } { + if (recipient.length == 1) { + if (recipient[0] == BROADCAST_TYPE) { + return { recipient: channel, type: NOTIFICATION_TYPE['BROADCAST'] }; + } else { + return { + recipient: recipient[0], + type: NOTIFICATION_TYPE['TARGETTED'], + }; + } + } + return { recipient, type: NOTIFICATION_TYPE['SUBSET'] }; + } + + // get identity type for lowlevel call + protected generateNotificationLowLevelPayload({ + signer, + env, + recipients, + options, + channel, + }: { + signer: SignerType; + env: ENV; + recipients: string[]; + options: NotificationOptions; + channel?: string; + }): ISendNotificationInputOptions { + if (!channel) { + channel = `${this.account}`; + } + const notificationType = this.getNotificationType(recipients, channel); + const identityType = IDENTITY_TYPE.DIRECT_PAYLOAD; + // fetch the minimal version based on conifg that was passed + let index; + if (options.payload?.index) { + if (options.payload?.index.value) { + index = + options.payload.index.index + + SETTING_DELIMITER + + SLIDER_TYPE + + SETTING_DELIMITER + + options.payload.index.value; + } else { + index = options.payload.index.index + SETTING_DELIMITER + BOOLEAN_TYPE; + } + } + const notificationPayload: ISendNotificationInputOptions = { + signer: signer, + channel: channel, + type: notificationType.type, + identityType: identityType, + notification: options.notification, + payload: { + title: options.payload?.title ?? options.notification.title, + body: options.payload?.body ?? options.notification.body, + cta: options.payload?.cta ?? '', + img: options.payload?.embed ?? '', + hidden: options.config?.hidden, + etime: options.config?.expiry, + silent: options.config?.silent, + additionalMeta: options.payload?.meta, + index: options.payload?.index ? index : '', + }, + recipients: notificationType.recipient, + graph: options.advanced?.graph, + ipfsHash: options.advanced?.ipfs, + env: env, + chatId: options.advanced?.chatid, + pgpPrivateKey: options.advanced?.pgpPrivateKey, + }; + + return notificationPayload; + } + + // check if the fields are empty + protected isEmpty(field: string) { + if (field.trim().length == 0) { + return true; + } + + return false; + } + + // check if the length is valid + protected isValidLength( + data: string, + upperLen: number = LENGTH_UPPER_LIMIT, + lowerLen: number = LENGTH_LOWER_LIMTI + ): boolean { + return data.length >= lowerLen && data.length <= upperLen!; + } + + // check if url is valid + protected isValidUrl(urlString: string): boolean { + const urlPattern = new RegExp( + '^((?:https|http):\\/\\/)' + // validate protocol + '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // validate domain name + '((\\d{1,3}\\.){3}\\d{1,3}))' + // validate OR ip (v4) address + '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // validate port and path + '(\\?[;&a-z\\d%_.~+=-]*)?' + // validate query string + '(\\#[-a-z\\d_]*)?$', + 'i' + ); // validate fragment locator + return !!urlPattern.test(urlString); + } + + // check all the fields of channel + protected verifyEmptyChannelParameters( + options: CreateChannelOptions + ): boolean { + if (this.isEmpty(options.name)) { + throw new Error('Channel name cannot be empty'); + } else if (this.isEmpty(options.description)) { + throw new Error('Channel description cannot be empty'); + } else if (this.isEmpty(options.icon)) { + throw new Error('Channel icon cannot be empty'); + } else if (this.isEmpty(options.url)) { + throw new Error('Channel url cannot ne empty'); + } else { + return true; + } + } + + // check for valid length and url + protected validateParameterLength(options: CreateChannelOptions): boolean { + if (!this.isValidLength(options.name)) { + throw new Error( + `Channel name should not exceed ${LENGTH_UPPER_LIMIT} characters` + ); + } else if (!this.isValidLength(options.description)) { + throw new Error( + `Channel description should not exceed ${LENGTH_UPPER_LIMIT} characters` + ); + } else if ( + !this.isValidLength(options.url) || + !this.isValidUrl(options.url) + ) { + throw new Error( + `Channel url either excees ${LENGTH_UPPER_LIMIT} characters or is not a valid url` + ); + } else { + return true; + } + } + + protected validateChannelParameters(options: CreateChannelOptions): boolean { + return ( + this.verifyEmptyChannelParameters(options) && + this.validateParameterLength(options) + ); + } + + // create contract instance + protected createContractInstance( + contractAddress: string | `0x${string}`, + contractABI: any, + network: Chain + ) { + let contract: any; + if ( + !('_signTypedData' in this.signer!) && + !('signTypedData' in this.signer!) + ) { + throw new Error('Unsupported signer type'); + } else if ('_signTypedData' in this.signer) { + if (!this.signer?.provider) { + throw new Error('Provider is required'); + } + contract = new ethers.Contract( + contractAddress, + contractABI, + this.signer as unknown as Signer + ); + } else if ('signTypedData' in this.signer) { + const client = createPublicClient({ + chain: network, + transport: http(), + }); + contract = getContract({ + abi: contractABI, + address: contractAddress as `0x${string}`, + publicClient: client, + walletClient: this.signer as unknown as WalletClient, + }); + } else { + throw new Error('Unsupported signer type'); + } + return contract; + } + + protected async fetchBalance(contract: any, userAddress: string) { + let balance: BigNumber; + try { + if ('_signTypedData' in this.signer!) { + balance = await contract!['balanceOf'](userAddress); + } else if ('signTypedData' in this.signer!) { + const balanceInBigInt = await contract.read.balanceOf({ + args: [userAddress], + }); + balance = ethers.BigNumber.from(balanceInBigInt); + } else { + throw new Error('Unsupported signer'); + } + return balance; + } catch (error) { + console.log(error); + throw new Error(JSON.stringify(error)); + } + } + + protected async fetchAllownace( + contract: any, + userAddress: string, + spenderAddress: string + ) { + let allowance: BigNumber; + try { + if ('_signTypedData' in this.signer!) { + allowance = await contract!['allowance'](userAddress, spenderAddress); + } else if ('signTypedData' in this.signer!) { + const allowanceInBigInt = await contract.read.allowance({ + args: [userAddress, spenderAddress], + }); + allowance = ethers.BigNumber.from(allowanceInBigInt); + } else { + throw new Error('Unsupported signer'); + } + return allowance; + } catch (error) { + throw new Error(JSON.stringify(error)); + } + } + + protected async fetchUpdateCounter(contract: any, userAddress: string) { + let count: BigNumber; + try { + if ('_signTypedData' in this.signer!) { + count = await contract!['channelUpdateCounter'](userAddress); + } else if ('signTypedData' in this.signer!) { + const countInBigInt = await contract.read.channelUpdateCounter({ + args: [userAddress], + }); + count = ethers.BigNumber.from(countInBigInt); + } else { + throw new Error('Unsupported signer'); + } + // add one and return the count + return count.add(ethers.BigNumber.from(1)); + } catch (error) { + throw new Error(JSON.stringify(error)); + } + } + + protected async approveToken( + contract: any, + spenderAddress: string, + amount: string | BigNumber + ) { + try { + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + const approvalTrxPromise = contract!['approve'](spenderAddress, amount); + const approvalTrx = await approvalTrxPromise; + await this.signer?.provider?.waitForTransaction(approvalTrx.hash); + // console.log(approvalTrx.hash) + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const approvalTrxPromise = contract.write.approve({ + args: [spenderAddress, amount], + }); + const approvalTrxRes = await approvalTrxPromise; + // console.log(approvalTrxRes); + } else { + throw new Error('Unsupported signer'); + } + return true; + } catch (error) { + console.log(error); + return false; + } + } + + protected async createChannel( + contract: any, + channelType: number, + identityBytes: Uint8Array, + fees: BigNumber + ) { + let createChannelRes; + try { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + if ('_signTypedData' in this.signer!) { + const createChannelPromise = contract!['createChannelWithPUSH']( + channelType, + identityBytes, + fees, + this.getTimeBound(), + { + gasLimit: 1000000, + } + ); + const createChannelTrx = await createChannelPromise; + const createChannelTrxStatus = + await this.signer?.provider?.waitForTransaction( + createChannelTrx.hash + ); + if (createChannelTrxStatus?.status == 0) { + throw new Error('Something Went wrong while creating your channel'); + } + createChannelRes = createChannelTrx.hash; + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const createChannelPromise = contract.write.createChannelWithPUSH({ + args: [channelType, identityBytes, fees, this.getTimeBound()], + }); + createChannelRes = await createChannelPromise; + } + + return createChannelRes; + } catch (error: any) { + throw new Error(error?.message); + } + } + + protected async updateChannel( + contract: any, + account: string, + identityBytes: Uint8Array, + fees: BigNumber + ) { + let updateChannelRes; + try { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + if ('_signTypedData' in this.signer!) { + const updateChannelPromise = contract!['updateChannelMeta']( + account, + identityBytes, + fees, + { + gasLimit: 1000000, + } + ); + const updateChannelTrx = await updateChannelPromise; + const updateChannelTrxStatus = + await this.signer?.provider?.waitForTransaction( + updateChannelTrx.hash + ); + if (updateChannelTrxStatus?.status == 0) { + throw new Error('Something Went wrong while updating your channel'); + } + updateChannelRes = updateChannelTrx.hash; + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const updateChannelPromise = contract.write.createChannelWithPUSH({ + args: [account, identityBytes, fees], + }); + updateChannelRes = await updateChannelPromise; + } + + return updateChannelRes; + } catch (error: any) { + throw new Error(error?.message); + } + } + + protected async verifyChannel(contract: any, channelToBeVerified: string) { + try { + let verifyTrxRes; + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + const verifyTrxPromise = contract!['verify'](channelToBeVerified); + const verifyTrx = await verifyTrxPromise; + await this.signer?.provider?.waitForTransaction(verifyTrx.hash); + verifyTrxRes = verifyTrx.hash; + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const verifyTrxPromise = contract.write.verify({ + args: [channelToBeVerified], + }); + verifyTrxRes = await verifyTrxPromise; + } else { + throw new Error('Unsupported signer'); + } + return verifyTrxRes; + } catch (error: any) { + throw new Error(error.message); + } + } + + protected async createChanelSettings( + contract: any, + numberOfSettings: number, + settings: string, + description: string, + fees: BigNumber + ) { + try { + let createSettingsRes; + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + const createSettingsPromise = contract!['createChannelSettings']( + numberOfSettings, + settings, + description, + fees + ); + const createSettings = await createSettingsPromise; + await this.signer?.provider?.waitForTransaction(createSettings.hash); + createSettingsRes = createSettings.hash; + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const createSettingsTrxPromise = contract.write.createChannelSettings({ + args: [numberOfSettings, settings, description, fees], + }); + createSettingsRes = await createSettingsTrxPromise; + } else { + throw new Error('Unsupported signer'); + } + return createSettingsRes; + } catch (error: any) { + throw new Error(error.message); + } + } + + protected async addDelegator(contract: any, delegatee: string) { + try { + let addDelegateRes; + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + const addDelegateTrxPromise = contract!['addDelegate'](delegatee); + const addDelegateTrx = await addDelegateTrxPromise; + await this.signer?.provider?.waitForTransaction(addDelegateTrx.hash); + addDelegateRes = addDelegateTrx.hash; + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const addDelegateTrxPromise = contract.write.addDelegate({ + args: [delegatee], + }); + addDelegateRes = await addDelegateTrxPromise; + } else { + throw new Error('Unsupported signer'); + } + return addDelegateRes; + } catch (error: any) { + throw new Error(error.message); + } + } + + protected async removeDelegator(contract: any, delegatee: string) { + try { + let removeDelegateRes; + if ('_signTypedData' in this.signer!) { + if (!this.signer || !this.signer.provider) { + throw new Error('ethers provider/signer is not provided'); + } + const removeDelegateTrxPromise = contract!['removeDelegate'](delegatee); + const removeDelegateTrx = await removeDelegateTrxPromise; + await this.signer?.provider?.waitForTransaction(removeDelegateTrx.hash); + removeDelegateRes = removeDelegateTrx.hash; + } else if ('signTypedData' in this.signer!) { + if (!contract.write) { + throw new Error('viem signer is not provided'); + } + const removeDelegateTrxPromise = contract.write.removeDelegate({ + args: [delegatee], + }); + removeDelegateRes = await removeDelegateTrxPromise; + } else { + throw new Error('Unsupported signer'); + } + return removeDelegateRes; + } catch (error: any) { + throw new Error(error.message); + } + } + + protected async getChianId(signer: SignerType) { + let chainId; + const isProviderExists = await this.checkProvider(signer); + if (!isProviderExists) { + throw new Error('Provider doesnt exists'); + } + if ('_signTypedData' in signer!) { + const chainDetails = await signer?.provider?.getNetwork(); + chainId = chainDetails?.chainId; + } else if ('signTypedData' in signer!) { + chainId = await signer.getChainId(); + } + return chainId; + } + + protected async checkProvider(signer: SignerType) { + let res = false; + if ('_signTypedData' in signer!) { + res = signer && signer?.provider ? true : false; + } else if ('signTypedData' in signer!) { + const chainId = await signer.getChainId(); + res = !!chainId; + } + return res; + } + + protected async uploadToIPFSViaPushNode(data: string): Promise<string> { + try { + const response = await axios.post( + `${config.CORE_CONFIG[this.env!].API_BASE_URL}/v1/ipfs/upload`, + { data } + ); + return response.data.cid as string; + } catch (error) { + throw new Error('Something went wrong while uploading data to IPFS'); + } + } + + protected getTimeBound(timeStamp?: number) { + // for now returns 0 for non-time bound. Later it can be modified to handle time bound channels + return 0; + } + + protected getMinimalSetting(configuration: NotificationSettings): { + setting: string; + description: string; + } { + let notificationSetting = ''; + let notificationSettingDescription = ''; + for (let i = 0; i < configuration.length; i++) { + const ele = configuration[i]; + if (ele.type == BOOLEAN_TYPE) { + notificationSetting = + notificationSetting + + SETTING_SEPARATOR + + BOOLEAN_TYPE + + SETTING_DELIMITER + + ele.default; + notificationSettingDescription = + notificationSettingDescription + SETTING_SEPARATOR + ele.description; + } + if (ele.type == 1) { + if (ele.data) { + const enabled = (ele.data && ele.data.enabled != undefined) ? Number(ele.data.enabled).toString() : DEFAULT_ENABLE_VALUE + const ticker = ele.data.ticker ?? DEFAULT_TICKER_VALUE + notificationSetting = + notificationSetting + + SETTING_SEPARATOR + + SLIDER_TYPE + + SETTING_DELIMITER+ + enabled+ + SETTING_DELIMITER + + ele.default + + SETTING_DELIMITER + + ele.data.lower + + SETTING_DELIMITER + + ele.data.upper + + SETTING_DELIMITER+ + ticker + + notificationSettingDescription = + notificationSettingDescription + + SETTING_SEPARATOR + + ele.description; + } + } + } + return { + setting: notificationSetting.replace(/^\+/, ''), + description: notificationSettingDescription.replace(/^\+/, ''), + }; + } + + protected getMinimalUserSetting(setting: UserSetting[]) { + if(!setting){ + return null; + } + let userSetting = ''; + let numberOfSettings = 0; + for (let i = 0; i < setting.length; i++) { + const ele = setting[i]; + const enabled = ele.enabled ? 1 : 0; + if (ele.enabled) numberOfSettings++; + // slider type + if (Object.keys(ele).includes('value')) { + userSetting = + userSetting + + SLIDER_TYPE + + SETTING_DELIMITER + + enabled + + SETTING_DELIMITER + + ele.value; + } else { + // boolean type + userSetting = userSetting + BOOLEAN_TYPE + SETTING_DELIMITER + enabled; + } + if (i != setting.length - 1) + userSetting = userSetting + SETTING_SEPARATOR; + } + return numberOfSettings + SETTING_SEPARATOR + userSetting; + } +} diff --git a/packages/restapi/src/lib/pushapi/PushAPI.ts b/packages/restapi/src/lib/pushapi/PushAPI.ts index a41d25b80..429b3aac3 100644 --- a/packages/restapi/src/lib/pushapi/PushAPI.ts +++ b/packages/restapi/src/lib/pushapi/PushAPI.ts @@ -1,40 +1,34 @@ -import Constants, { ENCRYPTION_TYPE, ENV, MessageType } from '../constants'; -import { - ChatSendOptionsType, - GroupAccess, - GroupDTO, - IFeeds, - MessageWithCID, - SignerType, - Message, - ProgressHookType, - IUser, -} from '../types'; -import { - GroupUpdateOptions, - ChatListType, - GroupCreationOptions, - ManageGroupOptions, - PushAPIInitializeProps, -} from './pushAPITypes'; +import Constants, { ENV } from '../constants'; +import { SignerType, ProgressHookType } from '../types'; +import { PushAPIInitializeProps } from './pushAPITypes'; import * as PUSH_USER from '../user'; import * as PUSH_CHAT from '../chat'; -import { getAccountAddress, getUserDID, getWallet } from '../chat/helpers'; -import { isValidETHAddress } from '../helpers'; -import { - ChatUpdateGroupProfileType, - updateGroupProfile, -} from '../chat/updateGroupProfile'; +import { getAccountAddress, getWallet } from '../chat/helpers'; +import { Chat } from './chat'; +import { Profile } from './profile'; +import { Encryption } from './encryption'; +import { User } from './user'; +import { PushStream } from '../pushstream/PushStream'; +import { Channel } from '../pushNotification/channel'; +import { Notification } from '../pushNotification/notification'; export class PushAPI { private signer: SignerType; private account: string; private decryptedPgpPvtKey: string; private pgpPublicKey: string; - private env: ENV; private progressHook?: (progress: ProgressHookType) => void; + public chat: Chat; // Public instances to be accessed from outside the class + public profile: Profile; + public encryption: Encryption; + private user: User; + public stream!: PushStream; + // Notification + public channel!: Channel; + public notification!: Notification; + private constructor( signer: SignerType, env: ENV, @@ -49,540 +43,153 @@ export class PushAPI { this.decryptedPgpPvtKey = decryptedPgpPvtKey; this.pgpPublicKey = pgpPublicKey; this.progressHook = progressHook; + // Instantiate the notification classes + this.channel = new Channel(this.signer, this.env, this.account); + this.notification = new Notification(this.signer, this.env, this.account); + // Initialize the instances of the four classes + this.chat = new Chat( + this.account, + this.decryptedPgpPvtKey, + this.env, + this.signer, + this.progressHook + ); + this.profile = new Profile( + this.account, + this.decryptedPgpPvtKey, + this.env, + this.progressHook + ); + this.encryption = new Encryption( + this.account, + this.decryptedPgpPvtKey, + this.pgpPublicKey, + this.env, + this.signer, + this.progressHook + ); + this.user = new User(this.account, this.env); } static async initialize( signer: SignerType, options?: PushAPIInitializeProps ): Promise<PushAPI> { - // Default options - const defaultOptions: PushAPIInitializeProps = { - env: ENV.STAGING, - version: Constants.ENC_TYPE_V3, - autoUpgrade: true, - account: null, - }; - - // Settings object - // Default options are overwritten by the options passed in the initialize method - const settings = { - ...defaultOptions, - ...options, - }; - - // Get account - // Derives account from signer if not provided - const derivedAccount = await getAccountAddress( - getWallet({ - account: settings.account as string | null, - signer: signer, - }) - ); - - let decryptedPGPPrivateKey: string; - let pgpPublicKey: string; - - /** - * Decrypt PGP private key - * If user exists, decrypts the PGP private key - * If user does not exist, creates a new user and returns the decrypted PGP private key - */ - const user = await PUSH_USER.get({ - account: derivedAccount, - env: settings.env, - }); - if (user && user.encryptedPrivateKey) { - decryptedPGPPrivateKey = await PUSH_CHAT.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - signer: signer, - toUpgrade: settings.autoUpgrade, - additionalMeta: settings.versionMeta, - progressHook: settings.progressHook, - env: settings.env, - }); - pgpPublicKey = user.publicKey; - } else { - const newUser = await PUSH_USER.create({ - env: settings.env, - account: derivedAccount, - signer, - version: settings.version, - additionalMeta: settings.versionMeta, - origin: settings.origin, - progressHook: settings.progressHook, - }); - decryptedPGPPrivateKey = newUser.decryptedPrivateKey as string; - pgpPublicKey = newUser.publicKey; - } - - // Initialize PushAPI instance - return new PushAPI( - signer, - settings.env as ENV, - derivedAccount, - decryptedPGPPrivateKey, - pgpPublicKey, - settings.progressHook - ); - } - - info = async () => { - return await PUSH_USER.get({ - account: this.account, - env: this.env, - }); - }; + try { + // Default options + const defaultOptions: PushAPIInitializeProps = { + env: ENV.STAGING, - profile = { - info: async () => { - const response = await PUSH_USER.get({ - account: this.account, - env: this.env, - }); - return response.profile; - }, + version: Constants.ENC_TYPE_V3, + autoUpgrade: true, - update: async (options: { - name?: string; - desc?: string; - picture?: string; - }) => { - const { name, desc, picture } = options; - const response = await PUSH_USER.profile.update({ - pgpPrivateKey: this.decryptedPgpPvtKey, - account: this.account, - profile: { - name: name, - desc: desc, - picture: picture, + account: null, + streamOptions: { + enabled: true, // Default value }, - env: this.env, - progressHook: this.progressHook, - }); - return response.profile; - }, - }; - - chat = { - list: async ( - type: `${ChatListType}`, - options?: { - /** - * @default 1 - */ - page?: number; - limit?: number; - } - ): Promise<IFeeds[]> => { - const listParams = { - account: this.account, - pgpPrivateKey: this.decryptedPgpPvtKey, - page: options?.page, - limit: options?.limit, - env: this.env, - toDecrypt: true, }; - switch (type) { - case ChatListType.CHATS: - return await PUSH_CHAT.chats(listParams); - case ChatListType.REQUESTS: - return await PUSH_CHAT.requests(listParams); - default: - throw new Error('Invalid Chat List Type'); - } - }, - - latest: async (target: string) => { - const { threadHash } = await PUSH_CHAT.conversationHash({ - conversationId: target, - account: this.account, - env: this.env, - }); - if (!threadHash) return {}; - - return await PUSH_CHAT.latest({ - threadhash: threadHash, - toDecrypt: true, - pgpPrivateKey: this.decryptedPgpPvtKey, - account: this.account, - env: this.env, - }); - }, - - history: async ( - target: string, - options?: { - reference?: string | null; - limit?: number; - } - ) => { - let reference: string; - - if (!options?.reference) { - const { threadHash } = await PUSH_CHAT.conversationHash({ - conversationId: target, - account: this.account, - env: this.env, - }); - reference = threadHash; - } else { - reference = options.reference; - } - - if (!reference) return []; - - return await PUSH_CHAT.history({ - account: this.account, - env: this.env, - threadhash: reference, - pgpPrivateKey: this.decryptedPgpPvtKey, - toDecrypt: true, - limit: options?.limit, - }); - }, - - send: async ( - recipient: string, - options: Message - ): Promise<MessageWithCID> => { - if (!options.type) { - options.type = MessageType.TEXT; - } - const sendParams: ChatSendOptionsType = { - message: options, - to: recipient, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - env: this.env, + // Settings object + // Default options are overwritten by the options passed in the initialize method + const settings = { + ...defaultOptions, + ...options, + version: options?.version || defaultOptions.version, + versionMeta: options?.versionMeta || defaultOptions.versionMeta, + autoUpgrade: + options?.autoUpgrade !== undefined + ? options?.autoUpgrade + : defaultOptions.autoUpgrade, + streamOptions: { + ...defaultOptions.streamOptions, + ...(options?.streamOptions ?? {}), + }, }; - return await PUSH_CHAT.send(sendParams); - }, - accept: async (target: string): Promise<string> => { - return await PUSH_CHAT.approve({ - senderAddress: target, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - }, - - reject: async (target: string): Promise<void> => { - await PUSH_CHAT.reject({ - senderAddress: target, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - }, - - block: async (users: Array<string>): Promise<IUser> => { - const user = await PUSH_USER.get({ - account: this.account, - env: this.env, - }); - - for (const element of users) { - if (!isValidETHAddress(element)) { - throw new Error('Invalid address in the users: ' + element); - } - } - - if (!user.profile.blockedUsersList) { - user.profile.blockedUsersList = []; - } + // Get account + // Derives account from signer if not provided + const derivedAccount = await getAccountAddress( + getWallet({ + account: settings.account as string | null, + signer: signer, + }) + ); - user.profile.blockedUsersList = [ - ...new Set([...user.profile.blockedUsersList, ...users]), - ]; + let decryptedPGPPrivateKey: string; + let pgpPublicKey: string; - return await PUSH_USER.profile.update({ - pgpPrivateKey: this.decryptedPgpPvtKey, - account: this.account, - profile: { - name: user.profile.name!, - desc: user.profile.desc!, - picture: user.profile.picture!, - blockedUsersList: user.profile.blockedUsersList, - }, - env: this.env, - progressHook: this.progressHook, - }); - }, - - unblock: async (users: Array<string>): Promise<IUser> => { + /** + * Decrypt PGP private key + * If user exists, decrypts the PGP private key + * If user does not exist, creates a new user and returns the decrypted PGP private key + */ const user = await PUSH_USER.get({ - account: this.account, - env: this.env, - }); - - for (const element of users) { - if (!isValidETHAddress(element)) { - throw new Error('Invalid address in the users: ' + element); - } - } - - if (!user.profile.blockedUsersList) { - return user; - } - - const userDIDsPromises = users.map(async (user) => { - return (await getUserDID(user, this.env)).toLowerCase(); - }); - const userDIDs = await Promise.all(userDIDsPromises); - - user.profile.blockedUsersList = user.profile.blockedUsersList.filter( - (blockedUser) => { - !userDIDs.includes(blockedUser.toLowerCase()); - } - ); - - return await PUSH_USER.profile.update({ - pgpPrivateKey: this.decryptedPgpPvtKey, - account: this.account, - profile: { - name: user.profile.name!, - desc: user.profile.desc!, - picture: user.profile.picture!, - blockedUsersList: user.profile.blockedUsersList, - }, - env: this.env, - progressHook: this.progressHook, + account: derivedAccount, + env: settings.env, }); - }, - - group: { - create: async (name: string, options?: GroupCreationOptions) => { - const groupParams: PUSH_CHAT.ChatCreateGroupType = { - groupName: name, - groupDescription: options?.description, - members: options?.members ? options.members : [], - groupImage: options?.image, - admins: options?.admins ? options.admins : [], - rules: { - groupAccess: options?.rules?.entry, - chatAccess: options?.rules?.chat, - }, - isPublic: !options?.private, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - env: this.env, - }; - - return await PUSH_CHAT.createGroup(groupParams); - }, - - permissions: async (chatId: string): Promise<GroupAccess> => { - const getGroupAccessOptions: PUSH_CHAT.GetGroupAccessType = { - chatId, - did: this.account, - env: this.env, - }; - return await PUSH_CHAT.getGroupAccess(getGroupAccessOptions); - }, - - info: async (chatId: string): Promise<GroupDTO> => { - return await PUSH_CHAT.getGroup({ - chatId: chatId, - env: this.env, - }); - }, - - update: async ( - chatId: string, - options: GroupUpdateOptions - ): Promise<GroupDTO> => { - // Fetch Group Details - const group = await PUSH_CHAT.getGroup({ - chatId: chatId, - env: this.env, + if (user && user.encryptedPrivateKey) { + decryptedPGPPrivateKey = await PUSH_CHAT.decryptPGPKey({ + encryptedPGPPrivateKey: user.encryptedPrivateKey, + signer: signer, + toUpgrade: settings.autoUpgrade, + additionalMeta: settings.versionMeta, + progressHook: settings.progressHook, + env: settings.env, }); - if (!group) { - throw new Error('Group not found'); - } - - const updateGroupProfileOptions: ChatUpdateGroupProfileType = { - chatId: chatId, - groupName: options.name ? options.name : group.groupName, - groupImage: options.image ? options.image : group.groupImage, - groupDescription: options.description - ? options.description - : group.groupDescription, - scheduleAt: options.scheduleAt - ? options.scheduleAt - : group.scheduleAt, - scheduleEnd: options.scheduleEnd - ? options.scheduleEnd - : group.scheduleEnd, - status: options.status ? options.status : group.status, - meta: options.meta ? options.meta : group.meta, - rules: options.rules ? options.rules : group.rules, - account: this.account, - pgpPrivateKey: this.decryptedPgpPvtKey, - env: this.env, - }; - return await updateGroupProfile(updateGroupProfileOptions); - }, - - add: async (chatId: string, options: ManageGroupOptions) => { - const { role, accounts } = options; - - const validRoles = ['ADMIN', 'MEMBER']; - if (!validRoles.includes(role)) { - throw new Error('Invalid role provided.'); - } - - if (!accounts || accounts.length === 0) { - throw new Error('accounts array cannot be empty!'); - } - - accounts.forEach((account) => { - if (!isValidETHAddress(account)) { - throw new Error(`Invalid account address: ${account}`); - } + pgpPublicKey = user.publicKey; + } else { + const newUser = await PUSH_USER.create({ + env: settings.env, + account: derivedAccount, + signer, + version: settings.version, + additionalMeta: settings.versionMeta, + origin: settings.origin, + progressHook: settings.progressHook, }); + decryptedPGPPrivateKey = newUser.decryptedPrivateKey as string; + pgpPublicKey = newUser.publicKey; + } - if (role === 'ADMIN') { - return await PUSH_CHAT.addAdmins({ - chatId: chatId, - admins: accounts, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - } else { - return await PUSH_CHAT.addMembers({ - chatId: chatId, - members: accounts, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - } - }, - - remove: async (chatId: string, options: ManageGroupOptions) => { - const { role, accounts } = options; - - const validRoles = ['ADMIN', 'MEMBER']; - if (!validRoles.includes(role)) { - throw new Error('Invalid role provided.'); - } - - if (!accounts || accounts.length === 0) { - throw new Error('accounts array cannot be empty!'); - } + // Initialize PushAPI instance + const api = new PushAPI( + signer, + settings.env as ENV, + derivedAccount, + decryptedPGPPrivateKey, + pgpPublicKey, + settings.progressHook + ); - accounts.forEach((account) => { - if (!isValidETHAddress(account)) { - throw new Error(`Invalid account address: ${account}`); + if (settings.streamOptions.enabled) { + const streamInstance = await PushStream.initialize( + api.account, + decryptedPGPPrivateKey, + signer, + settings.progressHook, + { + ...settings.streamOptions, + env: settings.env, // Use the env from the top-level PushAPIInitializeProps } - }); - - if (role === 'ADMIN') { - return await PUSH_CHAT.removeAdmins({ - chatId: chatId, - admins: accounts, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); + ); + if (streamInstance) { + api.stream = streamInstance; } else { - return await PUSH_CHAT.removeMembers({ - chatId: chatId, - members: accounts, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); + throw new Error('Failed to initialize PushStream.'); } - }, - - join: async (target: string): Promise<GroupDTO> => { - return await PUSH_CHAT.addMembers({ - chatId: target, - members: [this.account], - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - }, - - leave: async (target: string): Promise<GroupDTO> => { - return await PUSH_CHAT.removeMembers({ - chatId: target, - members: [this.account], - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - }, - - reject: async (target: string): Promise<void> => { - await PUSH_CHAT.reject({ - senderAddress: target, - env: this.env, - account: this.account, - signer: this.signer, - pgpPrivateKey: this.decryptedPgpPvtKey, - }); - }, - }, - }; - - encryption = { - info: async () => { - const userInfo = await this.info(); - const decryptedPassword = await PUSH_USER.decryptAuth({ - account: this.account, - env: this.env, - signer: this.signer, - progressHook: this.progressHook, - additionalMeta: { - NFTPGP_V1: { - encryptedPassword: JSON.stringify( - JSON.parse(userInfo.encryptedPrivateKey).encryptedPassword - ), - }, - }, - }); + } - return { - decryptedPgpPrivateKey: this.decryptedPgpPvtKey, - pgpPublicKey: this.pgpPublicKey, - ...(decryptedPassword !== undefined && decryptedPassword !== null - ? { decryptedPassword: decryptedPassword } - : {}), - }; - }, + return api; + } catch (error) { + console.error('Error initializing PushAPI:', error); + throw error; // or handle it more gracefully if desired + } + } - update: async ( - updatedEncryptionType: ENCRYPTION_TYPE, - options?: { - versionMeta?: { - NFTPGP_V1?: { password: string }; - }; - } - ) => { - return await PUSH_USER.auth.update({ - account: this.account, - pgpEncryptionVersion: updatedEncryptionType, - additionalMeta: options?.versionMeta, - progressHook: this.progressHook, - signer: this.signer, - env: this.env, - pgpPrivateKey: this.decryptedPgpPvtKey, - pgpPublicKey: this.pgpPublicKey, - }); - }, - }; + async info() { + return await PUSH_USER.get({ + account: this.account, + env: this.env, + }); + } } diff --git a/packages/restapi/src/lib/pushapi/chat.ts b/packages/restapi/src/lib/pushapi/chat.ts new file mode 100644 index 000000000..193db597a --- /dev/null +++ b/packages/restapi/src/lib/pushapi/chat.ts @@ -0,0 +1,450 @@ +import { ENV, MessageType } from '../constants'; +import { + ChatSendOptionsType, + GroupAccess, + GroupDTO, + IFeeds, + MessageWithCID, + SignerType, + Message, + ProgressHookType, + IUser, + IMessageIPFS, +} from '../types'; +import { + GroupUpdateOptions, + ChatListType, + GroupCreationOptions, + ManageGroupOptions, +} from './pushAPITypes'; +import * as PUSH_USER from '../user'; +import * as PUSH_CHAT from '../chat'; +import { getUserDID } from '../chat/helpers'; +import { isValidETHAddress } from '../helpers'; +import { + ChatUpdateGroupProfileType, + updateGroupProfile, +} from '../chat/updateGroupProfile'; +import { User } from './user'; +export class Chat { + private userInstance: User; + + constructor( + private account: string, + private decryptedPgpPvtKey: string, + private env: ENV, + private signer: SignerType, + private progressHook?: (progress: ProgressHookType) => void + ) { + this.userInstance = new User(this.account, this.env); + } + + async list( + type: `${ChatListType}`, + options?: { + /** + * @default 1 + */ + page?: number; + limit?: number; + } + ): Promise<IFeeds[]> { + const listParams = { + account: this.account, + pgpPrivateKey: this.decryptedPgpPvtKey, + page: options?.page, + limit: options?.limit, + env: this.env, + toDecrypt: true, + }; + + switch (type) { + case ChatListType.CHATS: + return await PUSH_CHAT.chats(listParams); + case ChatListType.REQUESTS: + return await PUSH_CHAT.requests(listParams); + default: + throw new Error('Invalid Chat List Type'); + } + } + async latest(target: string) { + const { threadHash } = await PUSH_CHAT.conversationHash({ + conversationId: target, + account: this.account, + env: this.env, + }); + if (!threadHash) return {}; + + return await PUSH_CHAT.latest({ + threadhash: threadHash, + toDecrypt: true, + pgpPrivateKey: this.decryptedPgpPvtKey, + account: this.account, + env: this.env, + }); + } + + async history( + target: string, + options?: { + reference?: string | null; + limit?: number; + } + ) { + let reference: string; + + if (!options?.reference) { + const { threadHash } = await PUSH_CHAT.conversationHash({ + conversationId: target, + account: this.account, + env: this.env, + }); + reference = threadHash; + } else { + reference = options.reference; + } + + if (!reference) return []; + + return await PUSH_CHAT.history({ + account: this.account, + env: this.env, + threadhash: reference, + pgpPrivateKey: this.decryptedPgpPvtKey, + toDecrypt: true, + limit: options?.limit, + }); + } + + async send(recipient: string, options: Message): Promise<MessageWithCID> { + if (!options.type) { + options.type = MessageType.TEXT; + } + const sendParams: ChatSendOptionsType = { + message: options, + to: recipient, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + env: this.env, + }; + return await PUSH_CHAT.send(sendParams); + } + + async decrypt(messagePayloads: IMessageIPFS[]) { + return await PUSH_CHAT.decryptConversation({ + pgpPrivateKey: this.decryptedPgpPvtKey, + env: this.env, + messages: messagePayloads, + connectedUser: await this.userInstance.info(), + }); + } + + async accept(target: string): Promise<string> { + return await PUSH_CHAT.approve({ + senderAddress: target, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } + + async reject(target: string): Promise<void> { + await PUSH_CHAT.reject({ + senderAddress: target, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } + + async block(users: Array<string>): Promise<IUser> { + const user = await PUSH_USER.get({ + account: this.account, + env: this.env, + }); + + for (const element of users) { + if (!isValidETHAddress(element)) { + throw new Error('Invalid address in the users: ' + element); + } + } + + if (!user.profile.blockedUsersList) { + user.profile.blockedUsersList = []; + } + + user.profile.blockedUsersList = [ + ...new Set([...user.profile.blockedUsersList, ...users]), + ]; + + return await PUSH_USER.profile.update({ + pgpPrivateKey: this.decryptedPgpPvtKey, + account: this.account, + profile: { + name: user.profile.name!, + desc: user.profile.desc!, + picture: user.profile.picture!, + blockedUsersList: user.profile.blockedUsersList, + }, + env: this.env, + progressHook: this.progressHook, + }); + } + + async unblock(users: Array<string>): Promise<IUser> { + const user = await PUSH_USER.get({ + account: this.account, + env: this.env, + }); + + for (const element of users) { + if (!isValidETHAddress(element)) { + throw new Error('Invalid address in the users: ' + element); + } + } + + if (!user.profile.blockedUsersList) { + return user; + } + + const userDIDsPromises = users.map(async (user) => { + return (await getUserDID(user, this.env)).toLowerCase(); + }); + const userDIDs = await Promise.all(userDIDsPromises); + + user.profile.blockedUsersList = user.profile.blockedUsersList.filter( + (blockedUser) => { + !userDIDs.includes(blockedUser.toLowerCase()); + } + ); + + return await PUSH_USER.profile.update({ + pgpPrivateKey: this.decryptedPgpPvtKey, + account: this.account, + profile: { + name: user.profile.name!, + desc: user.profile.desc!, + picture: user.profile.picture!, + blockedUsersList: user.profile.blockedUsersList, + }, + env: this.env, + progressHook: this.progressHook, + }); + } + + group = { + create: async (name: string, options?: GroupCreationOptions) => { + const groupParams: PUSH_CHAT.ChatCreateGroupType = { + groupName: name, + groupDescription: options?.description, + members: options?.members ? options.members : [], + groupImage: options?.image, + admins: options?.admins ? options.admins : [], + rules: options?.rules, + isPublic: !options?.private, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + env: this.env, + }; + + return await PUSH_CHAT.createGroup(groupParams); + }, + + permissions: async (chatId: string): Promise<GroupAccess> => { + const getGroupAccessOptions: PUSH_CHAT.GetGroupAccessType = { + chatId, + did: this.account, + env: this.env, + }; + return await PUSH_CHAT.getGroupAccess(getGroupAccessOptions); + }, + + info: async (chatId: string): Promise<GroupDTO> => { + return await PUSH_CHAT.getGroup({ + chatId: chatId, + env: this.env, + }); + }, + update: async ( + chatId: string, + options: GroupUpdateOptions + ): Promise<GroupDTO> => { + const group = await PUSH_CHAT.getGroup({ + chatId: chatId, + env: this.env, + }); + if (!group) { + throw new Error('Group not found'); + } + + const updateGroupProfileOptions: ChatUpdateGroupProfileType = { + chatId: chatId, + groupName: options.name ? options.name : group.groupName, + groupImage: options.image ? options.image : group.groupImage, + groupDescription: options.description + ? options.description + : group.groupDescription, + scheduleAt: options.scheduleAt ? options.scheduleAt : group.scheduleAt, + scheduleEnd: options.scheduleEnd + ? options.scheduleEnd + : group.scheduleEnd, + status: options.status ? options.status : group.status, + meta: options.meta ? options.meta : group.meta, + rules: options.rules ? options.rules : group.rules, + account: this.account, + pgpPrivateKey: this.decryptedPgpPvtKey, + env: this.env, + }; + return await updateGroupProfile(updateGroupProfileOptions); + }, + + add: async (chatId: string, options: ManageGroupOptions) => { + const { role, accounts } = options; + + const validRoles = ['ADMIN', 'MEMBER']; + if (!validRoles.includes(role)) { + throw new Error('Invalid role provided.'); + } + + if (!accounts || accounts.length === 0) { + throw new Error('accounts array cannot be empty!'); + } + + accounts.forEach((account) => { + if (!isValidETHAddress(account)) { + throw new Error(`Invalid account address: ${account}`); + } + }); + + if (role === 'ADMIN') { + return await PUSH_CHAT.addAdmins({ + chatId: chatId, + admins: accounts, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } else { + return await PUSH_CHAT.addMembers({ + chatId: chatId, + members: accounts, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } + }, + + remove: async (chatId: string, options: ManageGroupOptions) => { + const { role, accounts } = options; + + const validRoles = ['ADMIN', 'MEMBER']; + if (!validRoles.includes(role)) { + throw new Error('Invalid role provided.'); + } + + if (!accounts || accounts.length === 0) { + throw new Error('accounts array cannot be empty!'); + } + + accounts.forEach((account) => { + if (!isValidETHAddress(account)) { + throw new Error(`Invalid account address: ${account}`); + } + }); + + if (role === 'ADMIN') { + return await PUSH_CHAT.removeAdmins({ + chatId: chatId, + admins: accounts, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } else { + return await PUSH_CHAT.removeMembers({ + chatId: chatId, + members: accounts, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } + }, + + join: async (target: string): Promise<GroupDTO> => { + const status = await PUSH_CHAT.getGroupMemberStatus({ + chatId: target, + did: this.account, + env: this.env, + }); + + if (status.isPending) { + await PUSH_CHAT.approve({ + senderAddress: target, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } else if (!status.isMember) { + return await PUSH_CHAT.addMembers({ + chatId: target, + members: [this.account], + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } + + return await PUSH_CHAT.getGroup({ + chatId: target, + env: this.env, + }); + }, + + leave: async (target: string): Promise<GroupDTO> => { + const status = await PUSH_CHAT.getGroupMemberStatus({ + chatId: target, + did: this.account, + env: this.env, + }); + + if (status.isAdmin) { + return await PUSH_CHAT.removeAdmins({ + chatId: target, + admins: [this.account], + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } else { + return await PUSH_CHAT.removeMembers({ + chatId: target, + members: [this.account], + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + } + }, + reject: async (target: string): Promise<void> => { + await PUSH_CHAT.reject({ + senderAddress: target, + env: this.env, + account: this.account, + signer: this.signer, + pgpPrivateKey: this.decryptedPgpPvtKey, + }); + }, + }; +} diff --git a/packages/restapi/src/lib/pushapi/encryption.ts b/packages/restapi/src/lib/pushapi/encryption.ts new file mode 100644 index 000000000..14e1ec286 --- /dev/null +++ b/packages/restapi/src/lib/pushapi/encryption.ts @@ -0,0 +1,67 @@ +import { ENCRYPTION_TYPE, ENV } from '../constants'; +import { + SignerType, + ProgressHookType, +} from '../types'; +import * as PUSH_USER from '../user'; +import { User } from './user'; + +export class Encryption { + private userInstance: User; + + constructor( + private account: string, + private decryptedPgpPvtKey: string, + private pgpPublicKey: string, + private env: ENV, + private signer: SignerType, + private progressHook?: (progress: ProgressHookType) => void + ) { + this.userInstance = new User(this.account, this.env); + } + + async info() { + const userInfo = await this.userInstance.info(); + const decryptedPassword = await PUSH_USER.decryptAuth({ + account: this.account, + env: this.env, + signer: this.signer, + progressHook: this.progressHook, + additionalMeta: { + NFTPGP_V1: { + encryptedPassword: JSON.stringify( + JSON.parse(userInfo.encryptedPrivateKey).encryptedPassword + ), + }, + }, + }); + + return { + decryptedPgpPrivateKey: this.decryptedPgpPvtKey, + pgpPublicKey: this.pgpPublicKey, + ...(decryptedPassword !== undefined && decryptedPassword !== null + ? { decryptedPassword: decryptedPassword } + : {}), + }; + } + + async update( + updatedEncryptionType: ENCRYPTION_TYPE, + options?: { + versionMeta?: { + NFTPGP_V1?: { password: string }; + }; + } + ) { + return await PUSH_USER.auth.update({ + account: this.account, + pgpEncryptionVersion: updatedEncryptionType, + additionalMeta: options?.versionMeta, + progressHook: this.progressHook, + signer: this.signer, + env: this.env, + pgpPrivateKey: this.decryptedPgpPvtKey, + pgpPublicKey: this.pgpPublicKey, + }); + } +} diff --git a/packages/restapi/src/lib/pushapi/profile.ts b/packages/restapi/src/lib/pushapi/profile.ts new file mode 100644 index 000000000..f3a8861b0 --- /dev/null +++ b/packages/restapi/src/lib/pushapi/profile.ts @@ -0,0 +1,36 @@ +import { ProgressHookType } from '../types'; +import * as PUSH_USER from '../user'; +import { ENV } from '../constants'; + +export class Profile { + constructor( + private account: string, + private decryptedPgpPvtKey: string, + private env: ENV, + private progressHook?: (progress: ProgressHookType) => void + ) {} + + async info() { + const response = await PUSH_USER.get({ + account: this.account, + env: this.env, + }); + return response.profile; + } + + async update(options: { name?: string; desc?: string; picture?: string }) { + const { name, desc, picture } = options; + const response = await PUSH_USER.profile.update({ + pgpPrivateKey: this.decryptedPgpPvtKey, + account: this.account, + profile: { + name: name, + desc: desc, + picture: picture, + }, + env: this.env, + progressHook: this.progressHook, + }); + return response.profile; + } +} diff --git a/packages/restapi/src/lib/pushapi/pushAPITypes.ts b/packages/restapi/src/lib/pushapi/pushAPITypes.ts index 391598ffe..094b16488 100644 --- a/packages/restapi/src/lib/pushapi/pushAPITypes.ts +++ b/packages/restapi/src/lib/pushapi/pushAPITypes.ts @@ -1,4 +1,5 @@ import Constants, { ENV } from '../constants'; +import { PushStreamInitializeProps } from '../pushstream/pushStreamTypes'; import { ChatStatus, ProgressHookType, Rules } from '../types'; export enum ChatListType { @@ -13,6 +14,7 @@ export interface PushAPIInitializeProps { versionMeta?: { NFTPGP_V1?: { password: string } }; autoUpgrade?: boolean; origin?: string; + streamOptions?: PushStreamInitializeProps; } export interface GroupCreationOptions { @@ -21,14 +23,7 @@ export interface GroupCreationOptions { members?: string[]; admins?: string[]; private?: boolean; - rules?: { - entry?: { - conditions: any[]; - }; - chat?: { - conditions: any[]; - }; - }; + rules?: Rules | null; } export interface ManageGroupOptions { diff --git a/packages/restapi/src/lib/pushapi/user.ts b/packages/restapi/src/lib/pushapi/user.ts new file mode 100644 index 000000000..4a485e787 --- /dev/null +++ b/packages/restapi/src/lib/pushapi/user.ts @@ -0,0 +1,13 @@ +import * as PUSH_USER from '../user'; +import { ENV } from '../constants'; + +export class User { + constructor(private account: string, private env: ENV) {} + + async info() { + return await PUSH_USER.get({ + account: this.account, + env: this.env, + }); + } +} diff --git a/packages/restapi/src/lib/pushstream/DataModifier.ts b/packages/restapi/src/lib/pushstream/DataModifier.ts new file mode 100644 index 000000000..949a1ad45 --- /dev/null +++ b/packages/restapi/src/lib/pushstream/DataModifier.ts @@ -0,0 +1,379 @@ +import { + CreateGroupEvent, + GroupMeta, + GroupEventRawData, + UpdateGroupEvent, + MessageRawData, + MessageEvent, + MessageEventType, + Member, + GroupEventType, + LeaveGroupEvent, + JoinGroupEvent, + RequestEvent, + RemoveEvent, + NotificationEvent, + NotificationEventType, + NotificationType, + NOTIFICATION, +} from './pushStreamTypes'; + +export class DataModifier { + public static handleChatGroupEvent(data: any, includeRaw = false): any { + switch (data.eventType) { + case 'create': + return this.mapToCreateGroupEvent(data, includeRaw); + case 'update': + return this.mapToUpdateGroupEvent(data, includeRaw); + case GroupEventType.JoinGroup: + return this.mapToJoinGroupEvent(data, includeRaw); + case GroupEventType.LeaveGroup: + return this.mapToLeaveGroupEvent(data, includeRaw); + case MessageEventType.Request: + return this.mapToRequestEvent(data, includeRaw); + case GroupEventType.Remove: + return this.mapToRemoveEvent(data, includeRaw); + default: + console.warn('Unknown eventType:', data.eventType); + return data; + } + } + + private static mapToJoinGroupEvent( + data: any, + includeRaw: boolean + ): JoinGroupEvent { + const baseEventData: JoinGroupEvent = { + origin: data.messageOrigin, + timestamp: data.timestamp, + chatId: data.chatId, + from: data.from, + to: data.to, + event: GroupEventType.JoinGroup, + }; + + return includeRaw + ? { + ...baseEventData, + raw: { verificationProof: data.verificationProof }, + } + : baseEventData; + } + + private static mapToLeaveGroupEvent( + data: any, + includeRaw: boolean + ): LeaveGroupEvent { + const baseEventData: LeaveGroupEvent = { + origin: data.messageOrigin, + timestamp: data.timestamp, + chatId: data.chatId, + from: data.from, + to: data.to, + event: GroupEventType.LeaveGroup, + }; + + return includeRaw + ? { + ...baseEventData, + raw: { verificationProof: data.verificationProof }, + } + : baseEventData; + } + + private static mapToRequestEvent(data: any, includeRaw: boolean): any { + const eventData: RequestEvent = { + origin: data.messageOrigin, + timestamp: data.timestamp, + chatId: data.chatId, + from: data.from, + to: data.to, + event: MessageEventType.Request, + meta: { + group: data.isGroup || false, + }, + }; + + if (includeRaw) { + eventData.raw = { verificationProof: data.verificationProof }; + } + return eventData; + } + + private static mapToRemoveEvent(data: any, includeRaw: boolean): any { + // Whatever the structure of your RemoveEvent, modify accordingly + const eventData: RemoveEvent = { + origin: data.messageOrigin, + timestamp: data.timestamp, + chatId: data.chatId, + from: data.from, + to: data.to, + event: GroupEventType.Remove, + }; + + if (includeRaw) { + eventData.raw = { verificationProof: data.verificationProof }; + } + return eventData; + } + + private static buildChatGroupEventMetaAndRaw( + incomingData: any, + includeRaw: boolean + ): { + meta: GroupMeta; + raw?: GroupEventRawData; + } { + const mapMembersAdmins = (arr: any[]): Member[] => { + return arr.map((item) => ({ + address: item.wallet, + profile: { + image: item.image, + publicKey: item.publicKey, + }, + })); + }; + + const mapPendingMembersAdmins = (arr: any[]): Member[] => { + return arr.map((item) => ({ + address: item.wallet, + profile: { + image: item.image, + publicKey: item.publicKey, + }, + })); + }; + + const meta: GroupMeta = { + name: incomingData.groupName, + description: incomingData.groupDescription, + image: incomingData.groupImage, + owner: incomingData.groupCreator, + members: mapMembersAdmins( + incomingData.members.filter((m: any) => !m.isAdmin) + ), + admins: mapMembersAdmins( + incomingData.members.filter((m: any) => m.isAdmin) + ), + pending: { + members: mapPendingMembersAdmins( + incomingData.pendingMembers.filter((m: any) => !m.isAdmin) + ), + admins: mapPendingMembersAdmins( + incomingData.pendingMembers.filter((m: any) => m.isAdmin) + ), + }, + private: !incomingData.isPublic, + rules: incomingData.rules || {}, + }; + + if (includeRaw) { + const raw: GroupEventRawData = { + verificationProof: incomingData.verificationProof, + }; + return { meta, raw }; + } + + return { meta }; + } + + public static mapToGroupEvent( + eventType: GroupEventType, + incomingData: any, + includeRaw: boolean + ): CreateGroupEvent | UpdateGroupEvent { + const { meta, raw } = this.buildChatGroupEventMetaAndRaw( + incomingData, + includeRaw + ); + + const groupEvent: any = { + event: eventType, + origin: incomingData.messageOrigin, + timestamp: incomingData.timestamp, + chatId: incomingData.chatId, + from: incomingData.from, + meta, + }; + + if (includeRaw) { + groupEvent.raw = raw; + } + + return groupEvent as CreateGroupEvent | UpdateGroupEvent; + } + + public static mapToCreateGroupEvent( + incomingData: any, + includeRaw: boolean + ): CreateGroupEvent { + return this.mapToGroupEvent( + GroupEventType.CreateGroup, + incomingData, + includeRaw + ) as CreateGroupEvent; + } + + public static mapToUpdateGroupEvent( + incomingData: any, + includeRaw: boolean + ): UpdateGroupEvent { + return this.mapToGroupEvent( + GroupEventType.UpdateGroup, + incomingData, + includeRaw + ) as UpdateGroupEvent; + } + + public static mapToMessageEvent( + data: any, + includeRaw = false, + eventType: MessageEventType + ): MessageEvent { + const messageEvent: MessageEvent = { + event: eventType, + origin: data.messageOrigin, + timestamp: data.timestamp.toString(), + chatId: data.chatId, // TODO: ChatId not working for w2w + from: data.fromCAIP10, + to: [data.toCAIP10], // TODO: Assuming 'to' is an array in MessageEvent. Update as necessary. + message: { + type: data.messageType, + content: data.messageContent, + }, + meta: { + group: data.isGroup || false, + }, + reference: data.cid, + }; + + if (includeRaw) { + const rawData: MessageRawData = { + fromCAIP10: data.fromCAIP10, + toCAIP10: data.toCAIP10, + fromDID: data.fromDID, + toDID: data.toDID, + encType: data.encType, + encryptedSecret: data.encryptedSecret, + signature: data.signature, + sigType: data.sigType, + verificationProof: data.verificationProof, + previousReference: data.link, + }; + messageEvent.raw = rawData; + } + + return messageEvent; + } + + public static handleChatEvent(data: any, includeRaw = false): any { + if (!data) { + console.error('Error in handleChatEvent: data is undefined or null'); + throw new Error('data is undefined or null'); + } + + const eventTypeMap: { [key: string]: MessageEventType } = { + Chat: MessageEventType.Message, + Request: MessageEventType.Request, + Approve: MessageEventType.Accept, + Reject: MessageEventType.Reject, + }; + + const key = data.eventType || data.messageCategory; + + if (!eventTypeMap[key]) { + console.error( + 'Error in handleChatEvent: Invalid eventType or messageCategory', + JSON.stringify(data) + ); + throw new Error('Invalid eventType or messageCategory in data'); + } + + const eventType: MessageEventType = eventTypeMap[key]; + + if (eventType) { + return this.mapToMessageEvent( + data, + includeRaw, + eventType as MessageEventType + ); + } else { + console.warn( + 'Unknown eventType:', + data.eventType || data.messageCategory + ); + return data; + } + } + + public static mapToNotificationEvent( + data: any, + notificationEventType: NotificationEventType, + origin: 'other' | 'self', + includeRaw = false + ): NotificationEvent { + const notificationType = + (Object.keys(NOTIFICATION.TYPE) as NotificationType[]).find( + (key) => NOTIFICATION.TYPE[key] === data.payload.data.type + ) || 'BROADCAST'; // Assuming 'BROADCAST' as the default + + + let recipients: string[]; + + if (Array.isArray(data.payload.recipients)) { + recipients = data.payload.recipients; + } else if (typeof data.payload.recipients === 'string') { + recipients = [data.payload.recipients]; + } else { + recipients = Object.keys(data.payload.recipients); + } + + const notificationEvent: NotificationEvent = { + event: notificationEventType, + origin: origin, + timestamp: data.epoch, + from: data.sender, + to: recipients, + notifID: data.payload_id.toString(), + channel: { + name: data.payload.data.app, + icon: data.payload.data.icon, + url: data.payload.data.url, + }, + meta: { + type: 'NOTIFICATION.' + notificationType, + }, + message: { + notification: { + title: data.payload.notification.title, + body: data.payload.notification.body, + }, + payload: { + title: data.payload.data.asub, + body: data.payload.data.amsg, + cta: data.payload.data.acta, + embed: data.payload.data.aimg, + meta: { + domain: data.payload.data.additionalMeta?.domain || 'push.org', + type: data.payload.data.additionalMeta?.type, + data: data.payload.data.additionalMeta?.data, + }, + }, + }, + config: { + expiry: data.payload.data.etime, + silent: data.payload.data.silent === '1', + hidden: data.payload.data.hidden === '1', + }, + source: data.source, + }; + + if (includeRaw) { + notificationEvent.raw = { + verificationProof: data.payload.verificationProof, + }; + } + + return notificationEvent; + } +} diff --git a/packages/restapi/src/lib/pushstream/PushStream.ts b/packages/restapi/src/lib/pushstream/PushStream.ts new file mode 100644 index 000000000..f7102175e --- /dev/null +++ b/packages/restapi/src/lib/pushstream/PushStream.ts @@ -0,0 +1,280 @@ +import { EventEmitter } from 'events'; +import { createSocketConnection, EVENTS } from '@pushprotocol/socket'; +import { ENV } from '../constants'; +import { + GroupEventType, + MessageEventType, + NotificationEventType, + ProposedEventNames, + PushStreamInitializeProps, + STREAM, +} from './pushStreamTypes'; +import { DataModifier } from './DataModifier'; +import { pCAIP10ToWallet, walletToPCAIP10 } from '../helpers'; +import { Chat } from '../pushapi/chat'; +import { ProgressHookType, SignerType } from '../types'; + +export class PushStream extends EventEmitter { + private pushChatSocket: any; + private pushNotificationSocket: any; + + private account: string; + private raw: boolean; + private options: PushStreamInitializeProps; + private chatInstance: Chat; + + constructor( + account: string, + private decryptedPgpPvtKey: string, + private signer: SignerType, + options: PushStreamInitializeProps, + private progressHook?: (progress: ProgressHookType) => void + ) { + super(); + + this.account = account; + this.pushChatSocket = createSocketConnection({ + user: walletToPCAIP10(account), + socketType: 'chat', + socketOptions: { + autoConnect: options.connection?.auto ?? true, + reconnectionAttempts: options.connection?.retries ?? 3, + }, + env: options.env as ENV, + }); + + this.pushNotificationSocket = createSocketConnection({ + user: pCAIP10ToWallet(this.account), + env: options.env as ENV, + socketOptions: { + autoConnect: options.connection?.auto ?? true, + reconnectionAttempts: options.connection?.retries ?? 3, + }, + }); + + if (!this.pushNotificationSocket) { + throw new Error('Push notification socket not connected'); + } + + if (!this.pushChatSocket) { + throw new Error('Push chat socket not connected'); + } + + this.raw = options.raw ?? false; + this.options = options; + + this.chatInstance = new Chat( + this.account, + this.decryptedPgpPvtKey, + this.options.env as ENV, + this.signer, + this.progressHook + ); + } + + static async initialize( + account: string, + decryptedPgpPvtKey: string, + signer: SignerType, + progressHook?: (progress: ProgressHookType) => void, + options?: PushStreamInitializeProps + ): Promise<PushStream> { + const defaultOptions: PushStreamInitializeProps = { + listen: [], + env: ENV.LOCAL, + raw: false, + connection: { + auto: true, + retries: 3, + }, + }; + + const settings = { + ...defaultOptions, + ...options, + }; + + const stream = new PushStream( + account, + decryptedPgpPvtKey, + signer, + settings, + progressHook + ); + await stream.init(); + return stream; + } + + private convertToProposedName(currentEventName: string): ProposedEventNames { + switch (currentEventName) { + case 'message': + return ProposedEventNames.Message; + case 'request': + return ProposedEventNames.Request; + case 'accept': + return ProposedEventNames.Accept; + case 'reject': + return ProposedEventNames.Reject; + case 'leaveGroup': + return ProposedEventNames.LeaveGroup; + case 'joinGroup': + return ProposedEventNames.JoinGroup; + case 'createGroup': + return ProposedEventNames.CreateGroup; + case 'updateGroup': + return ProposedEventNames.UpdateGroup; + case 'remove': + return ProposedEventNames.Remove; + default: + throw new Error(`Unknown current event name: ${currentEventName}`); + } + } + + private handleToField(data: any): void { + switch (data.event) { + case ProposedEventNames.LeaveGroup: + case ProposedEventNames.JoinGroup: + data.to = null; + break; + + case ProposedEventNames.Accept: + case ProposedEventNames.Reject: + if (data.meta?.group) { + data.to = null; + } + break; + + default: + break; + } + } + + private shouldEmitChat(dataChatId: string): boolean { + if (!this.options.filter?.chats || this.options.filter.chats.length === 0) { + return true; + } + return this.options.filter.chats.includes(dataChatId); + } + + private shouldEmitChannel(dataChannelId: string): boolean { + if ( + !this.options.filter?.channels || + this.options.filter.channels.length === 0 + ) { + return true; + } + return this.options.filter.channels.includes(dataChannelId); + } + + public async init(): Promise<void> { + const shouldEmit = (eventType: STREAM): boolean => { + if (!this.options.listen || this.options.listen.length === 0) { + return true; + } + return this.options.listen.includes(eventType); + }; + + this.pushChatSocket.on(EVENTS.CHAT_GROUPS, (data: any) => { + try { + const modifiedData = DataModifier.handleChatGroupEvent(data, this.raw); + modifiedData.event = this.convertToProposedName(modifiedData.event); + this.handleToField(modifiedData); + if (this.shouldEmitChat(data.chatId)) { + if ( + data.eventType === GroupEventType.JoinGroup || + data.eventType === GroupEventType.LeaveGroup || + data.eventType === MessageEventType.Request || + data.eventType === GroupEventType.Remove + ) { + if (shouldEmit(STREAM.CHAT)) { + this.emit(STREAM.CHAT, modifiedData); + } + } else { + if (shouldEmit(STREAM.CHAT_OPS)) { + this.emit(STREAM.CHAT_OPS, modifiedData); + } + } + } + } catch (error) { + console.error( + 'Error handling CHAT_GROUPS event:', + error, + 'Data:', + data + ); + } + }); + + this.pushChatSocket.on(EVENTS.CHAT_RECEIVED_MESSAGE, async (data: any) => { + try { + if ( + data.messageCategory == 'Chat' || + data.messageCategory == 'Request' + ) { + data = await this.chatInstance.decrypt([data]); + data = data[0]; + } + + const modifiedData = DataModifier.handleChatEvent(data, this.raw); + modifiedData.event = this.convertToProposedName(modifiedData.event); + this.handleToField(modifiedData); + if (this.shouldEmitChat(data.chatId)) { + if (shouldEmit(STREAM.CHAT)) { + this.emit(STREAM.CHAT, modifiedData); + } + } + } catch (error) { + console.error( + 'Error handling CHAT_RECEIVED_MESSAGE event:', + error, + 'Data:', + data + ); + } + }); + + this.pushNotificationSocket.on(EVENTS.USER_FEEDS, (data: any) => { + try { + const modifiedData = DataModifier.mapToNotificationEvent( + data, + NotificationEventType.INBOX, + this.account === data.sender ? 'self' : 'other', + this.raw + ); + + if (this.shouldEmitChannel(modifiedData.from)) { + if (shouldEmit(STREAM.NOTIF)) { + this.emit(STREAM.NOTIF, modifiedData); + } + } + } catch (error) { + console.error('Error handling USER_FEEDS event:', error, 'Data:', data); + } + }); + + this.pushNotificationSocket.on(EVENTS.USER_SPAM_FEEDS, (data: any) => { + try { + const modifiedData = DataModifier.mapToNotificationEvent( + data, + NotificationEventType.SPAM, + this.account === data.sender ? 'self' : 'other', + this.raw + ); + modifiedData.origin = + this.account === modifiedData.from ? 'self' : 'other'; + if (this.shouldEmitChannel(modifiedData.from)) { + if (shouldEmit(STREAM.NOTIF)) { + this.emit(STREAM.NOTIF, modifiedData); + } + } + } catch (error) { + console.error( + 'Error handling USER_SPAM_FEEDS event:', + error, + 'Data:', + data + ); + } + }); + } +} diff --git a/packages/restapi/src/lib/pushstream/pushStreamTypes.ts b/packages/restapi/src/lib/pushstream/pushStreamTypes.ts new file mode 100644 index 000000000..e96496edb --- /dev/null +++ b/packages/restapi/src/lib/pushstream/pushStreamTypes.ts @@ -0,0 +1,233 @@ +import { Rules } from "../types"; +import Constants, { ENV } from '../constants'; + +export type PushStreamInitializeProps = { + listen?: STREAM[]; + filter?: { + channels?: string[]; + chats?: string[]; + }; + connection?: { + auto?: boolean; + retries?: number; + }; + raw?: boolean; + env?: ENV; + enabled?: boolean; +}; + +export enum STREAM { + PROFILE = 'STREAM.PROFILE', + ENCRYPTION = 'STREAM.ENCRYPTION', + NOTIF = 'STREAM.NOTIF', + NOTIF_OPS = 'STREAM.NOTIF_OPS', + CHAT = 'STREAM.CHAT', + CHAT_OPS = 'STREAM.CHAT_OPS', +} + +export enum NotificationEventType { + INBOX = 'notification.inbox', + SPAM = 'notification.spam', +} + + +export enum MessageOrigin { + Other = 'other', + Self = 'self', +} + +export enum MessageEventType { + Message = 'message', + Request = 'request', + Accept = 'accept', + Reject = 'reject', +} + +export enum GroupEventType { + CreateGroup = 'createGroup', + UpdateGroup = 'updateGroup', + JoinGroup = 'joinGroup', + LeaveGroup = 'leaveGroup', + Remove = 'remove', +} + +export enum ProposedEventNames { + Message = 'chat.message', + Request = 'chat.request', + Accept = 'chat.accept', + Reject = 'chat.reject', + LeaveGroup = 'chat.group.participant.leave', + JoinGroup = 'chat.group.participant.join', + CreateGroup = 'chat.group.create', + UpdateGroup = 'chat.group.update', + Remove = 'chat.group.participant.remove', +} + + +export interface Profile { + image: string; + publicKey: string; +} + +export interface Member { + address: string; + profile: Profile; +} + +export interface Pending { + members: Member[]; + admins: Member[]; +} + +export interface GroupMeta { + name: string; + description: string; + image: string; + owner: string; + members: Member[]; + admins: Member[]; + pending: Pending; + private: boolean; + rules: Rules; +} + +export interface GroupEventRawData { + verificationProof: string; +} + +export interface GroupEventBase { + origin: MessageOrigin; + timestamp: string; + chatId: string; + from: string; + meta: GroupMeta; + raw?: GroupEventRawData; + event: GroupEventType; +} + +export interface CreateGroupEvent extends GroupEventBase { + event: GroupEventType.CreateGroup; +} + +export interface UpdateGroupEvent extends GroupEventBase { + event: GroupEventType.UpdateGroup; +} + +export interface GroupMemberEventBase { + event: GroupEventType | MessageEventType; + origin: MessageOrigin; + timestamp: string; + chatId: string; + from: string; + to: string[]; + raw?: GroupEventRawData; +} + +export interface JoinGroupEvent extends GroupMemberEventBase { + event: GroupEventType.JoinGroup; +} + +export interface LeaveGroupEvent extends GroupMemberEventBase { + event: GroupEventType.LeaveGroup; +} + +export interface RequestEvent extends GroupMemberEventBase { + event: MessageEventType.Request; + meta: { + group: boolean; + }; +} + +export interface RemoveEvent extends GroupMemberEventBase { + event: GroupEventType.Remove; +} + + +export interface MessageEvent { + event: MessageEventType; + origin: MessageOrigin; + timestamp: string; + chatId: string; + from: string; + to: string[]; + message: { + type: string; + content: string; + }; + meta: { + group: boolean; + }; + reference: string; + raw?: MessageRawData; +} + +export const NOTIFICATION = { + TYPE: { + BROADCAST: 1, + TARGETTED: 3, + SUBSET: 4, + }, +} as const; + +export type NotificationType = keyof typeof NOTIFICATION.TYPE; + + + +export interface NotificationEvent { + event: NotificationEventType; + origin: 'other' | 'self'; + timestamp: string; + from: string; + to: string[]; + notifID: string; + channel: { + name: string; + icon: string; + url: string; + }; + meta: { + type: string; + }; + message: { + notification: { + title: string; + body: string; + }; + payload?: { + title?: string; + body?: string; + cta?: string; + embed?: string; + meta?: { + domain?: string; + type: string; + data: string; + }; + }; + }; + config?: { + expiry?: number; + silent?: boolean; + hidden?: boolean; + }; + advanced?: { + chatid?: string; + }; + source: string; + raw?: { + verificationProof: string; + }; +} + +export interface MessageRawData { + fromCAIP10: string; + toCAIP10: string; + fromDID: string; + toDID: string; + encType: string; + encryptedSecret: string; + signature: string; + sigType: string; + verificationProof: string; + previousReference: string; +} \ No newline at end of file diff --git a/packages/restapi/src/lib/space/Space.ts b/packages/restapi/src/lib/space/Space.ts index 7ddd78b27..a466da5fb 100644 --- a/packages/restapi/src/lib/space/Space.ts +++ b/packages/restapi/src/lib/space/Space.ts @@ -29,7 +29,7 @@ import { } from '../types'; import { VIDEO_CALL_TYPE } from '../payloads/constants'; import sendLiveSpaceData from './helpers/sendLiveSpaceData'; -import { META_ACTION } from '../types/messageTypes'; +import { CHAT } from '../types/messageTypes'; import { broadcastRaisedHand } from './broadcastRaisedHand'; import { onReceiveMetaMessage } from './onReceiveMetaMessage'; import { onJoinListener } from './onJoinListener'; @@ -157,7 +157,7 @@ export class Space extends Video { env: this.env, spaceId: this.spaceSpecificData.spaceId, signer: this.signer, - action: META_ACTION.PROMOTE_TO_ADMIN, // TODO: Add a meta action for SPEAKER_JOINED + action: CHAT.META.GROUP.ADMIN.PRVILEGE, // TODO: Add a meta action for SPEAKER_JOINED }); } }, diff --git a/packages/restapi/src/lib/space/acceptPromotionRequest.ts b/packages/restapi/src/lib/space/acceptPromotionRequest.ts index 0a5ea4ea3..6ed125b25 100644 --- a/packages/restapi/src/lib/space/acceptPromotionRequest.ts +++ b/packages/restapi/src/lib/space/acceptPromotionRequest.ts @@ -36,14 +36,14 @@ export async function acceptPromotionRequest( }); // accept the promotion request - this.acceptRequest({ - signalData, - senderAddress: this.data.local.address, - recipientAddress: pCAIP10ToWallet(promoteeAddress), - chatId: spaceId, - details: { - type: SPACE_ACCEPT_REQUEST_TYPE.ACCEPT_PROMOTION, - data: {}, - }, - }); + // this.acceptRequest({ + // signalData, + // senderAddress: this.data.local.address, + // recipientAddress: pCAIP10ToWallet(promoteeAddress), + // chatId: spaceId, + // details: { + // type: SPACE_ACCEPT_REQUEST_TYPE.ACCEPT_PROMOTION, + // data: {}, + // }, + // }); } diff --git a/packages/restapi/src/lib/space/broadcastRaisedHand.ts b/packages/restapi/src/lib/space/broadcastRaisedHand.ts index db2c0b1c9..d90b706e8 100644 --- a/packages/restapi/src/lib/space/broadcastRaisedHand.ts +++ b/packages/restapi/src/lib/space/broadcastRaisedHand.ts @@ -1,6 +1,6 @@ import { produce } from 'immer'; import sendLiveSpaceData from './helpers/sendLiveSpaceData'; -import { META_ACTION } from '../types/messageTypes'; +import { CHAT } from '../types/messageTypes'; import { pCAIP10ToWallet } from '../helpers'; import type Space from './Space'; @@ -41,6 +41,6 @@ export async function broadcastRaisedHand( env: this.env, spaceId: this.spaceSpecificData.spaceId, signer: this.signer, - action: META_ACTION.USER_INTERACTION, + action: CHAT.META.GROUP.USER.INTERACTION, }); } diff --git a/packages/restapi/src/lib/space/helpers/getLiveSpaceData.ts b/packages/restapi/src/lib/space/helpers/getLiveSpaceData.ts index 4d3f952a4..7f8896b00 100644 --- a/packages/restapi/src/lib/space/helpers/getLiveSpaceData.ts +++ b/packages/restapi/src/lib/space/helpers/getLiveSpaceData.ts @@ -1,7 +1,7 @@ import { conversationHash, history } from '../../chat'; import { MessageType } from '../../constants'; import { EnvOptionsType, LiveSpaceData } from '../../types'; -import { MetaMessage } from '../../types/messageTypes'; +import { InfoMessage } from '../../types/messageTypes'; import { initLiveSpaceData } from '../Space'; interface GetLatestMessageType extends EnvOptionsType { @@ -54,7 +54,7 @@ const getLiveSpaceData = async ({ latestMetaMessage.messageObj !== null ) { // found the latest meta message - liveSpaceData = (latestMetaMessage.messageObj as Omit<MetaMessage, 'type'>) + liveSpaceData = (latestMetaMessage.messageObj as Omit<InfoMessage, 'type'>) ?.info?.arbitrary as LiveSpaceData; } diff --git a/packages/restapi/src/lib/space/helpers/sendLiveSpaceData.ts b/packages/restapi/src/lib/space/helpers/sendLiveSpaceData.ts index 78cb59fb1..099eed844 100644 --- a/packages/restapi/src/lib/space/helpers/sendLiveSpaceData.ts +++ b/packages/restapi/src/lib/space/helpers/sendLiveSpaceData.ts @@ -1,11 +1,10 @@ import { send } from '../../chat'; import { MessageType } from '../../constants'; import { EnvOptionsType, LiveSpaceData, SignerType } from '../../types'; -import { META_ACTION } from '../../types/messageTypes'; interface SendLiveSpaceData extends EnvOptionsType { liveSpaceData?: LiveSpaceData; - action: META_ACTION; + action: string; spaceId: string; pgpPrivateKey: string; signer: SignerType; @@ -26,8 +25,7 @@ const sendLiveSpaceData = async ({ signer, messageType: MessageType.META, messageObj: { - content: 'PUSH SPACE META MESSAGE', - action, + content: action, info: { affected: [], arbitrary: liveSpaceData, diff --git a/packages/restapi/src/lib/space/onJoinListener.ts b/packages/restapi/src/lib/space/onJoinListener.ts index 30db1c4dd..72aa30c68 100644 --- a/packages/restapi/src/lib/space/onJoinListener.ts +++ b/packages/restapi/src/lib/space/onJoinListener.ts @@ -3,7 +3,7 @@ import { get } from './get'; import { pCAIP10ToWallet } from '../helpers'; import { produce } from 'immer'; -import { META_ACTION } from '../types/messageTypes'; +import { CHAT } from '../types/messageTypes'; import type Space from './Space'; export interface OnJoinListenerType { @@ -43,11 +43,12 @@ export async function onJoinListener(this: Space, options: OnJoinListenerType) { const modifiedLiveSpaceData = produce( this.spaceSpecificData.liveSpaceData, (draft) => { - const isListenerAlreadyAdded = this.spaceSpecificData.liveSpaceData.listeners.find( - (currentListener) => - pCAIP10ToWallet(currentListener.address) === - pCAIP10ToWallet(receivedAddress) - ); + const isListenerAlreadyAdded = + this.spaceSpecificData.liveSpaceData.listeners.find( + (currentListener) => + pCAIP10ToWallet(currentListener.address) === + pCAIP10ToWallet(receivedAddress) + ); if (isListenerAlreadyAdded) { // listener is already added in the meta message @@ -75,6 +76,6 @@ export async function onJoinListener(this: Space, options: OnJoinListenerType) { env: this.env, signer: this.signer, liveSpaceData: modifiedLiveSpaceData, - action: META_ACTION.ADD_LISTENER, + action: CHAT.META.SPACE.LISTENER.ADD, }); } diff --git a/packages/restapi/src/lib/space/onReceiveMetaMessage.ts b/packages/restapi/src/lib/space/onReceiveMetaMessage.ts index f6b6ae24c..800511e31 100644 --- a/packages/restapi/src/lib/space/onReceiveMetaMessage.ts +++ b/packages/restapi/src/lib/space/onReceiveMetaMessage.ts @@ -1,6 +1,6 @@ import { MessageType } from '../constants'; import { IMessageIPFS, LiveSpaceData } from '../types'; -import { MetaMessage } from '../types/messageTypes'; +import { InfoMessage } from '../types/messageTypes'; import type Space from './Space'; export interface OnReceiveMetaMessageType { @@ -18,14 +18,14 @@ export function onReceiveMetaMessage( if ( receivedMetaMessage.messageType !== MessageType.META || typeof receivedMetaMessage.messageObj !== 'object' || - !(receivedMetaMessage?.messageObj as Omit<MetaMessage, 'type'>)?.info + !(receivedMetaMessage?.messageObj as Omit<InfoMessage, 'type'>)?.info ?.arbitrary ) { return; } const receivedLiveSpaceData = ( - receivedMetaMessage.messageObj as Omit<MetaMessage, 'type'> + receivedMetaMessage.messageObj as Omit<InfoMessage, 'type'> ).info.arbitrary as LiveSpaceData; console.log('RECEIVED LIVE SPACE DATA', receivedLiveSpaceData); diff --git a/packages/restapi/src/lib/space/rejectPromotionRequest.ts b/packages/restapi/src/lib/space/rejectPromotionRequest.ts index 3fb45154b..f2be499e9 100644 --- a/packages/restapi/src/lib/space/rejectPromotionRequest.ts +++ b/packages/restapi/src/lib/space/rejectPromotionRequest.ts @@ -1,6 +1,6 @@ import { produce } from 'immer'; import sendLiveSpaceData from './helpers/sendLiveSpaceData'; -import { META_ACTION } from '../types/messageTypes'; +import { CHAT } from '../types/messageTypes'; import { pCAIP10ToWallet } from '../helpers'; import type Space from './Space'; @@ -41,6 +41,6 @@ export async function rejectPromotionRequest( env: this.env, spaceId: this.spaceSpecificData.spaceId, signer: this.signer, - action: META_ACTION.USER_INTERACTION, // TODO: Add a reject request type + action: CHAT.META.GROUP.USER.INTERACTION, // TODO: Add a reject request type }); } diff --git a/packages/restapi/src/lib/space/start.ts b/packages/restapi/src/lib/space/start.ts index 6a14791e7..5fd42f966 100644 --- a/packages/restapi/src/lib/space/start.ts +++ b/packages/restapi/src/lib/space/start.ts @@ -24,21 +24,22 @@ export interface StartSpaceType extends EnvOptionsType { import type Space from './Space'; import { produce } from 'immer'; import { pCAIP10ToWallet } from '../helpers'; -import { META_ACTION } from '../types/messageTypes'; +import { CHAT } from '../types/messageTypes'; import sendLiveSpaceData from './helpers/sendLiveSpaceData'; type StartType = { livepeerApiKey: string; }; -export async function start(this: Space, options: StartType): Promise<void> { - const { livepeerApiKey } = options || {}; +// export async function start(this: Space, options: StartType): Promise<void> { +export async function start(this: Space): Promise<void> { + // const { livepeerApiKey } = options || {}; try { // host should have there audio stream - if (!this.data.local.stream) { - throw new Error('Local audio stream not found'); - } + // if (!this.data.local.stream) { + // throw new Error('Local audio stream not found'); + // } const space = await get({ spaceId: this.spaceSpecificData.spaceId, @@ -93,7 +94,7 @@ export async function start(this: Space, options: StartType): Promise<void> { await sendLiveSpaceData({ liveSpaceData, - action: META_ACTION.CREATE_SPACE, + action: CHAT.META.SPACE.CREATE, spaceId: this.spaceSpecificData.spaceId, signer: this.signer, pgpPrivateKey: this.pgpPrivateKey, @@ -115,109 +116,109 @@ export async function start(this: Space, options: StartType): Promise<void> { }); }); - // start the livepeer playback and store the playback URL group meta - // send a notification/meta message to all the added listeners (members) telling the space has started - - // create the mergeStream object - const mergedStream = getMergeStreamObject(this.data.local.stream); - // store the mergeStreamObject - this.mergedStream = mergedStream; - - const url = 'https://livepeer.studio/api/stream'; - const data = { - name: this.spaceSpecificData.spaceName, - record: true, - }; - - const { data: responseData } = await axios.post(url, data, { - headers: { - Authorization: 'Bearer ' + livepeerApiKey, - }, - }); - - const { streamKey, playbackId } = responseData; - - console.log('livepeer details', streamKey, playbackId); - - this.update({ meta: playbackId }); - - let redirectUrl; - try { - console.log('Ignore the following error'); - - // the redirect URL from the above GET request - await axios.get(`https://livepeer.studio/webrtc/${streamKey}`); - } catch (err: any) { - console.log('redirectUrl error', err); - redirectUrl = err.request.responseURL; - } - - // we use the host from the redirect URL in the ICE server configuration - const host = new URL(redirectUrl).host; - - const iceServers = [ - { - urls: `stun:${host}`, - }, - { - urls: `turn:${host}`, - username: 'livepeer', - credential: 'livepeer', - }, - ]; - - const peerConnection = new RTCPeerConnection({ iceServers }); - - const newAudioTrack = mergedStream.result?.getAudioTracks?.()?.[0] ?? null; - - if (newAudioTrack) { - peerConnection?.addTransceiver(newAudioTrack, { - direction: 'sendonly', - }); - } - - /** - * https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer - * We create an SDP offer here which will be shared with the server - */ - const offer = await peerConnection.createOffer(); - /** https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setLocalDescription */ - await peerConnection.setLocalDescription(offer); - - /** Wait for ICE gathering to complete */ - const ofr = await new Promise<RTCSessionDescription | null>((resolve) => { - /** Wait at most five seconds for ICE gathering. */ - setTimeout(() => { - resolve(peerConnection.localDescription); - }, 5000); - peerConnection.onicegatheringstatechange = (_ev) => { - if (peerConnection.iceGatheringState === 'complete') { - resolve(peerConnection.localDescription); - } - }; - }); - if (!ofr) { - throw Error('failed to gather ICE candidates for offer'); - } - /** - * This response contains the server's SDP offer. - * This specifies how the client should communicate, - * and what kind of media client and server have negotiated to exchange. - */ - const sdpResponse = await fetch(redirectUrl, { - method: 'POST', - mode: 'cors', - headers: { - 'content-type': 'application/sdp', - }, - body: ofr.sdp, - }); - if (sdpResponse.ok) { - const answerSDP = await sdpResponse.text(); - await peerConnection.setRemoteDescription( - new RTCSessionDescription({ type: 'answer', sdp: answerSDP }) - ); - } + // // start the livepeer playback and store the playback URL group meta + // // send a notification/meta message to all the added listeners (members) telling the space has started + + // // create the mergeStream object + // const mergedStream = getMergeStreamObject(this.data.local.stream); + // // store the mergeStreamObject + // this.mergedStream = mergedStream; + + // const url = 'https://livepeer.studio/api/stream'; + // const data = { + // name: this.spaceSpecificData.spaceName, + // record: true, + // }; + + // const { data: responseData } = await axios.post(url, data, { + // headers: { + // Authorization: 'Bearer ' + livepeerApiKey, + // }, + // }); + + // const { streamKey, playbackId } = responseData; + + // console.log('livepeer details', streamKey, playbackId); + + // this.update({ meta: playbackId }); + + // let redirectUrl; + // try { + // console.log('Ignore the following error'); + + // // the redirect URL from the above GET request + // await axios.get(`https://livepeer.studio/webrtc/${streamKey}`); + // } catch (err: any) { + // console.log('redirectUrl error', err); + // redirectUrl = err.request.responseURL; + // } + + // // we use the host from the redirect URL in the ICE server configuration + // const host = new URL(redirectUrl).host; + + // const iceServers = [ + // { + // urls: `stun:${host}`, + // }, + // { + // urls: `turn:${host}`, + // username: 'livepeer', + // credential: 'livepeer', + // }, + // ]; + + // const peerConnection = new RTCPeerConnection({ iceServers }); + + // const newAudioTrack = mergedStream.result?.getAudioTracks?.()?.[0] ?? null; + + // if (newAudioTrack) { + // peerConnection?.addTransceiver(newAudioTrack, { + // direction: 'sendonly', + // }); + // } + + // /** + // * https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer + // * We create an SDP offer here which will be shared with the server + // */ + // const offer = await peerConnection.createOffer(); + // /** https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setLocalDescription */ + // await peerConnection.setLocalDescription(offer); + + // /** Wait for ICE gathering to complete */ + // const ofr = await new Promise<RTCSessionDescription | null>((resolve) => { + // /** Wait at most five seconds for ICE gathering. */ + // setTimeout(() => { + // resolve(peerConnection.localDescription); + // }, 5000); + // peerConnection.onicegatheringstatechange = (_ev) => { + // if (peerConnection.iceGatheringState === 'complete') { + // resolve(peerConnection.localDescription); + // } + // }; + // }); + // if (!ofr) { + // throw Error('failed to gather ICE candidates for offer'); + // } + // /** + // * This response contains the server's SDP offer. + // * This specifies how the client should communicate, + // * and what kind of media client and server have negotiated to exchange. + // */ + // const sdpResponse = await fetch(redirectUrl, { + // method: 'POST', + // mode: 'cors', + // headers: { + // 'content-type': 'application/sdp', + // }, + // body: ofr.sdp, + // }); + // if (sdpResponse.ok) { + // const answerSDP = await sdpResponse.text(); + // await peerConnection.setRemoteDescription( + // new RTCSessionDescription({ type: 'answer', sdp: answerSDP }) + // ); + // } console.log('Live Stream started'); } catch (err) { diff --git a/packages/restapi/src/lib/types/index.ts b/packages/restapi/src/lib/types/index.ts index 3394cdbec..336175364 100644 --- a/packages/restapi/src/lib/types/index.ts +++ b/packages/restapi/src/lib/types/index.ts @@ -116,6 +116,7 @@ export interface ISendNotificationInputOptions { * use additionalMeta instead */ metadata?: any; + index?: string; }; recipients?: string | string[]; // CAIP or plain ETH channel: string; // CAIP or plain ETH @@ -315,10 +316,10 @@ export type Data = { contract?: string; amount?: number; decimals?: number; - guildId?: string; - guildRoleId?: string; + id?: string; + role?: string; url?: string; - comparison?: '>' | '<' | '>=' | '<=' | '==' | '!='; + comparison?: '>' | '<' | '>=' | '<=' | '==' | '!=' | 'all' | 'any'; }; export type ConditionBase = { @@ -327,6 +328,7 @@ export type ConditionBase = { subcategory?: string; data?: Data; access?: boolean; + }; export type Condition = ConditionBase & { @@ -335,28 +337,35 @@ export type Condition = ConditionBase & { }; export interface Rules { - groupAccess?: { - conditions: Array<Condition | ConditionBase>; + entry?: { + conditions: Array<Condition | ConditionBase> | (Condition | ConditionBase); }; - chatAccess?: { - conditions: Array<Condition | ConditionBase>; + chat?: { + conditions: Array<Condition | ConditionBase> | (Condition | ConditionBase); }; } + export interface SpaceRules { - spaceAccess?: { - conditions: Array<Condition | ConditionBase>; + entry?: { + conditions: Array<Condition | ConditionBase> | (Condition | ConditionBase); }; } export interface GroupAccess { - groupAccess: boolean; - chatAccess: boolean; + entry: boolean; + chat: boolean; rules?: Rules; } +export interface GroupMemberStatus { + isMember: boolean; + isPending: boolean; + isAdmin: boolean; +} + export interface SpaceAccess { - spaceAccess: boolean; + entry: boolean; rules?: SpaceRules; } @@ -536,7 +545,7 @@ export interface UserInfo { isAdmin: boolean; } -type ethersV5SignerType = { +export type ethersV5SignerType = { _signTypedData: ( domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, @@ -548,7 +557,7 @@ type ethersV5SignerType = { privateKey?: string; provider?: providers.Provider; }; -type viemSignerType = { +export type viemSignerType = { signTypedData: (args: { account: any; domain: any; @@ -565,6 +574,7 @@ type viemSignerType = { account: { [key: string]: any }; privateKey?: string; provider?: providers.Provider; + }; export type SignerType = ethersV5SignerType | viemSignerType; diff --git a/packages/restapi/src/lib/types/messageTypes.ts b/packages/restapi/src/lib/types/messageTypes.ts index 49f4d986a..634121784 100644 --- a/packages/restapi/src/lib/types/messageTypes.ts +++ b/packages/restapi/src/lib/types/messageTypes.ts @@ -3,67 +3,92 @@ */ import { MessageType } from '../constants'; -export enum META_ACTION { - /** - * DEFAULT GROUP ACTIONS - */ - CREATE_GROUP = 1, - ADD_MEMBER = 2, - REMOVE_MEMBER = 3, - PROMOTE_TO_ADMIN = 4, - DEMOTE_FROM_ADMIN = 5, - /** - * SHARED ACTIONS - */ - CHANGE_IMAGE_OR_DESC = 6, - CHANGE_META = 7, - /** - * SPACES ACTIONS - */ - CREATE_SPACE = 8, - ADD_LISTENER = 9, - REMOVE_LISTENER = 10, - PROMOTE_TO_SPEAKER = 11, - DEMOTE_FROM_SPEARKER = 12, - PROMOTE_TO_COHOST = 13, - DEMOTE_FROM_COHOST = 14, - USER_INTERACTION = 15, // For MIC_ON | MIC_OFF | RAISE_HAND | EMOJI REACTION | or any other user activity -} +export const CHAT = { + META: { + GROUP: { + CREATE: 'CREATE_GROUP', + MEMBER: { + ADD: 'ADD_MEMBER', + REMOVE: 'REMOVE_MEMBER', + PRIVILEGE: 'ASSIGN_MEMBER_PRIVILEGE', + }, + ADMIN: { + PRVILEGE: 'ASSIGN_ADMIN_PRIVILEGE', + }, + // todo: Why do we need update group when we already have profile and meta update + UPDATE: 'UPDATE_GROUP', + PROFILE: { + UPDATE: 'UPDATE_GROUP_PROFILE', + }, + // todo : this seems to be a wierd name CHAT.META.GROUP.META.UPDATE + META: { + UPDATE: 'UPDATE_GROUP_META', + }, + // todo : Remove this as it comes under UserActivity now ( remove after space changes ) + USER: { + INTERACTION: 'USER_INTERACTION', + }, + }, + SPACE: { + CREATE: 'CREATE_SPACE', + LISTENER: { + ADD: 'ADD_LISTENER', + REMOVE: 'REMOVE_LISTENER', + PRVILEGE: 'ASSIGN_LISTENER_PRIVILEGE', + }, + SPEAKER: { + PRVILEGE: 'ASSIGN_SPEAKER_PRIVILEGE', + }, + COHOST: { + PRVILEGE: 'ASSIGN_COHOST_PRIVILEGE', + }, + }, + }, -export enum REACTION_TYPE { - THUMBS_UP, - THUMBS_DOWN, - HEART, - CLAP, - LAUGHING_FACE, - SAD_FACE, - ANGRY_FACE, - SURPRISED_FACE, - CLAPPING_HANDS, - FIRE, -} + REACTION: { + THUMBSUP: '\u{1F44D}', + THUMBSDOWN: '\u{1F44E}', + HEART: '\u{2764}\u{FE0F}', + CLAP: '\u{1F44F}', + LAUGH: '\u{1F602}', + SAD: '\u{1F622}', + ANGRY: '\u{1F621}', + SUPRISE: '\u{1F632}', + FIRE: '\u{1F525}', + }, + + RECEIPT: { + READ: 'READ_RECEIPT', + }, -// Create a mapping object that associates reaction types with their Unicode escape sequences -export const REACTION_SYMBOL: Record<REACTION_TYPE, string> = { - [REACTION_TYPE.THUMBS_UP]: '\u{1F44D}', - [REACTION_TYPE.THUMBS_DOWN]: '\u{1F44E}', - [REACTION_TYPE.HEART]: '\u{2764}\u{FE0F}', - [REACTION_TYPE.CLAP]: '\u{1F44F}', - [REACTION_TYPE.LAUGHING_FACE]: '\u{1F602}', - [REACTION_TYPE.SAD_FACE]: '\u{1F622}', - [REACTION_TYPE.ANGRY_FACE]: '\u{1F621}', - [REACTION_TYPE.SURPRISED_FACE]: '\u{1F632}', - [REACTION_TYPE.CLAPPING_HANDS]: '\u{1F44F}\u{1F44F}', - [REACTION_TYPE.FIRE]: '\u{1F525}', + UA: { + LISTENER: { + JOIN: 'LISTENER_JOIN', + LEAVE: 'LISTENER_LEAVE', + MICREQUEST: 'LISTENER_REQUEST_MIC', + }, + SPEAKER: { + MIC_ON: 'SPEAKER_MIC_ON', + MIC_OFF: 'SPEAKER_MIC_OFF', + }, + }, + + INTENT: { + ACCEPT: 'ACCEPT_INTENT', + REJECT: 'REJECT_INTENT', + JOIN: 'JOIN_GROUP', + LEAVE: 'LEAVE_GROUP', + }, }; -export interface BaseMessage<T> { +interface BaseMessage<T> { type?: T; content: string; } -export interface MetaMessage extends BaseMessage<`${MessageType.META}`> { - action: META_ACTION; +// Used by MessageType.Meta & MessageType.USER_ACTIVITY +export interface InfoMessage + extends BaseMessage<`${MessageType.META}` | `${MessageType.USER_ACTIVITY}`> { info: { affected: string[]; arbitrary?: { @@ -72,28 +97,53 @@ export interface MetaMessage extends BaseMessage<`${MessageType.META}`> { }; } -export interface ReactionMessage - extends BaseMessage<`${MessageType.REACTION}`> { - action: REACTION_TYPE; - reference?: string | null; +interface ReferenceMessage + extends BaseMessage<`${MessageType.REACTION}` | `${MessageType.RECEIPT}`> { + reference: string; +} + +interface ReplyMessage { + type: `${MessageType.REPLY}`; + /** Only Few BaseMessageTypes are allowed, this can be changed in the future */ + content: { + type: string; + content: string; + }; + reference: string; +} + +interface CompositeMessage { + type: `${MessageType.COMPOSITE}`; + /** Only Few BaseMessageTypes are allowed, this can be changed in the future */ + content: { + type: string; + content: string; + }[]; } -export type BaseMessageTypes = +type BaseMessageTypes = | `${MessageType.TEXT}` | `${MessageType.IMAGE}` + | `${MessageType.VIDEO}` + | `${MessageType.AUDIO}` | `${MessageType.FILE}` + | `${MessageType.GIF}` | `${MessageType.MEDIA_EMBED}` - | `${MessageType.GIF}`; + | `${MessageType.INTENT}`; export type Message = | BaseMessage<BaseMessageTypes> - | MetaMessage - | ReactionMessage; + | InfoMessage + | ReferenceMessage + | ReplyMessage + | CompositeMessage; /** * @deprecated */ export type MessageObj = | Omit<BaseMessage<BaseMessageTypes>, 'type'> - | Omit<MetaMessage, 'type'> - | Omit<ReactionMessage, 'type'>; + | Omit<InfoMessage, 'type'> + | Omit<ReferenceMessage, 'type'> + | Omit<ReplyMessage, 'type'> + | Omit<CompositeMessage, 'type'>; diff --git a/packages/restapi/src/lib/user/getFeedsPerChannel.ts b/packages/restapi/src/lib/user/getFeedsPerChannel.ts new file mode 100644 index 000000000..fb6d902d4 --- /dev/null +++ b/packages/restapi/src/lib/user/getFeedsPerChannel.ts @@ -0,0 +1,57 @@ +import axios from 'axios'; +import { + getCAIPAddress, + getAPIBaseUrls, + getQueryParams, + getLimit, +} from '../helpers'; +import Constants, { ENV } from '../constants'; +import { parseApiResponse } from '../utils'; + +export type FeedsPerChannelOptionsType = { + user: string; + env?: ENV; + channels?: [string]; + page?: number; + limit?: number; + spam?: boolean; + raw?: boolean; +}; + +export const getFeedsPerChannel = async (options: FeedsPerChannelOptionsType) => { + const { + user, + env = Constants.ENV.PROD, + page = Constants.PAGINATION.INITIAL_PAGE, + limit = Constants.PAGINATION.LIMIT, + spam = false, + raw = false, + channels = [], + } = options || {}; + + const _user = await getCAIPAddress(env, user, 'User'); + const API_BASE_URL = getAPIBaseUrls(env); + if (channels.length == 0) { + throw new Error('channels cannot be empty'); + } + const _channel = await getCAIPAddress(env, channels[0], 'Channel'); + const apiEndpoint = `${API_BASE_URL}/v1/users/${_channel}/channels/${_user}/feeds`; + const queryObj = { + page, + limit: getLimit(limit), + spam, + }; + + const requestUrl = `${apiEndpoint}?${getQueryParams(queryObj)}`; + return axios + .get(requestUrl) + .then((response) => { + if (raw) { + return response?.data?.feeds || []; + } + return parseApiResponse(response?.data?.feeds) || []; + }) + .catch((err) => { + console.error(`[Push SDK] - API ${requestUrl}: `, err); + }); +}; diff --git a/packages/restapi/src/lib/user/index.ts b/packages/restapi/src/lib/user/index.ts index 9f1a7bbe3..3d5fff4f8 100644 --- a/packages/restapi/src/lib/user/index.ts +++ b/packages/restapi/src/lib/user/index.ts @@ -10,6 +10,8 @@ export * from './getUsersBatch'; export * from './upgradeUser'; export * from './decryptAuth'; export * from './createUserWithProfile'; +export * from './getFeedsPerChannel'; + export const auth = { update: authUpdate, }; diff --git a/packages/restapi/src/lib/validations/messageObject.ts b/packages/restapi/src/lib/validations/messageObject.ts index 6057d12d5..d40382126 100644 --- a/packages/restapi/src/lib/validations/messageObject.ts +++ b/packages/restapi/src/lib/validations/messageObject.ts @@ -1,14 +1,26 @@ import * as Joi from 'joi'; -import { META_ACTION, REACTION_TYPE } from '../types/messageTypes'; +import { CHAT, MessageObj } from '../types/messageTypes'; +import { MessageType } from '../constants'; -export const messageObjSchema = Joi.object({ +const extractValidValues = (obj: any): string[] => { + const validValues: string[] = []; + for (const key in obj) { + if (typeof obj[key] === 'string') { + validValues.push(obj[key]); + } else if (typeof obj[key] === 'object') { + validValues.push(...extractValidValues(obj[key])); + } + } + return validValues; +}; + +const messageObjSchema = Joi.object({ content: Joi.string().required().allow(''), }); -export const metaMessageObjSchema = Joi.object({ - content: Joi.string().required().allow(''), - action: Joi.number() - .valid(...Object.values(META_ACTION)) +const metaMessageObjSchema = Joi.object({ + content: Joi.string() + .valid(...Object.values(extractValidValues(CHAT.META))) .required(), info: Joi.object({ affected: Joi.array().items(Joi.string()).required(), @@ -16,10 +28,133 @@ export const metaMessageObjSchema = Joi.object({ }).required(), }); -export const reationMessageObjSchema = Joi.object({ - content: Joi.string().required().allow(''), - action: Joi.number() - .valid(...Object.values(REACTION_TYPE)) +const reationMessageObjSchema = Joi.object({ + content: Joi.string() + .valid(...Object.values(extractValidValues(CHAT.REACTION))) + .required(), + reference: Joi.string().required(), +}); + +const receiptMessageObjSchema = Joi.object({ + content: Joi.string() + .valid(...Object.values(extractValidValues(CHAT.RECEIPT))) .required(), - reference: Joi.string().allow(null), + reference: Joi.string().required(), }); + +const userActivityMessageObjSchema = Joi.object({ + content: Joi.string() + .valid(...Object.values(extractValidValues(CHAT.UA))) + .required(), + info: Joi.object({ + affected: Joi.array().items(Joi.string()).required(), + arbitrary: Joi.object().pattern(Joi.string(), Joi.any()), + }).required(), +}); + +const intentMessageObjSchema = Joi.object({ + content: Joi.string().valid( + ...Object.values(extractValidValues(CHAT.INTENT)) + ), +}); + +const replyMessageObjSchema = Joi.object({ + content: Joi.object({ + messageType: Joi.string() + .valid( + ...Object.values([ + MessageType.TEXT, + MessageType.IMAGE, + MessageType.AUDIO, + MessageType.VIDEO, + MessageType.FILE, + MessageType.MEDIA_EMBED, + ]) + ) + .required(), + messageObj: Joi.object({ + content: Joi.string().required(), // Change the validation as needed + }).required(), + }).required(), + reference: Joi.string().required(), +}); + +const compositeMessageObjSchema = Joi.object({ + content: Joi.array() + .items( + Joi.object({ + messageType: Joi.string() + .valid( + ...Object.values([ + MessageType.TEXT, + MessageType.IMAGE, + MessageType.AUDIO, + MessageType.VIDEO, + MessageType.FILE, + MessageType.MEDIA_EMBED, + ]) + ) + .required(), + messageObj: Joi.object({ + content: Joi.string().required(), + }).required(), + }) + ) + .required(), +}); + +export const validateMessageObj = ( + messageObj: MessageObj, + messageType: MessageType +) => { + let error: Joi.ValidationError | undefined = undefined; + switch (messageType) { + case MessageType.TEXT: + case MessageType.IMAGE: + case MessageType.VIDEO: + case MessageType.AUDIO: + case MessageType.FILE: + case MessageType.MEDIA_EMBED: + case MessageType.GIF: { + error = messageObjSchema.validate(messageObj).error; + break; + } + case MessageType.META: { + error = metaMessageObjSchema.validate(messageObj).error; + break; + } + case MessageType.REACTION: { + error = reationMessageObjSchema.validate(messageObj).error; + break; + } + case MessageType.RECEIPT: { + error = receiptMessageObjSchema.validate(messageObj).error; + break; + } + case MessageType.USER_ACTIVITY: { + error = userActivityMessageObjSchema.validate(messageObj).error; + break; + } + case MessageType.INTENT: { + error = intentMessageObjSchema.validate(messageObj).error; + break; + } + case MessageType.REPLY: { + error = replyMessageObjSchema.validate(messageObj).error; + break; + } + case MessageType.COMPOSITE: { + error = compositeMessageObjSchema.validate(messageObj).error; + break; + } + default: { + throw new Error('Invalid MessageType'); + } + } + + if (error) { + throw new Error( + `Unable to parse this messageType. Please ensure 'messageObj' is properly defined.` + ); + } +}; diff --git a/packages/restapi/tests/lib/channel/sendNotification.test.ts b/packages/restapi/tests/lib/channel/sendNotification.test.ts new file mode 100644 index 000000000..692e8e740 --- /dev/null +++ b/packages/restapi/tests/lib/channel/sendNotification.test.ts @@ -0,0 +1,70 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../.env') }); +import * as PUSH_PAYLOAD from '../../../src/lib/payloads'; +import { expect } from 'chai'; +import Constants from '../../../src/lib/constants'; +import { ethers } from 'ethers'; + +describe('PUSH_PAYLOAD.sendNotification functionality', () => { + let signer1: any; + let account1: string; + let signer2: any; + let account2: string; + + beforeEach(async () => { + signer1 = new ethers.Wallet( + '0xb9d00f786e1d024cfed08f696a775217ff75501f4aacef5ec0795fc4a2eb9df1' + ); + account1 = signer1.address; + + const WALLET2 = ethers.Wallet.createRandom(); + signer2 = new ethers.Wallet(WALLET2.privateKey); + account2 = WALLET2.address; + }); + + it('Should send notification with setting index', async () => { + enum IDENTITY_TYPE { + MINIMAL = 0, + IPFS = 1, + DIRECT_PAYLOAD = 2, + SUBGRAPH = 3, + } + + enum NOTIFICATION_TYPE { + BROADCAST = 1, + TARGETTED = 3, + SUBSET = 4, + } + + enum ENV { + PROD = 'prod', + STAGING = 'staging', + DEV = 'dev', + /** + * **This is for local development only** + */ + LOCAL = 'local', + } + const res = await PUSH_PAYLOAD.sendNotification({ + env: ENV.DEV, + signer: signer1, + type: NOTIFICATION_TYPE.BROADCAST, + identityType: IDENTITY_TYPE.DIRECT_PAYLOAD, + + notification: { + title: 'hey', + body: 'hey', + }, + payload: { + title: 'hey', + body: 'hey', + cta: '', + img: '', + index: '1-2-10', + }, + channel: `eip155:5:${account1}`, + }); + expect(res.status).to.be.equal(204); + }); +}); diff --git a/packages/restapi/tests/lib/channel/subscribeV2.test.ts b/packages/restapi/tests/lib/channel/subscribeV2.test.ts new file mode 100644 index 000000000..b1bd3f0b4 --- /dev/null +++ b/packages/restapi/tests/lib/channel/subscribeV2.test.ts @@ -0,0 +1,56 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../.env') }); +import * as PUSH_CHANNEL from '../../../src/lib/channels/'; +import { expect } from 'chai'; +import Constants from '../../../src/lib/constants'; +import { ethers } from 'ethers'; + +describe('PUSH_CHANNEL.subscribeV2 functionality', () => { + let signer1: any; + let account1: string; + let signer2: any; + let account2: string; + + beforeEach(async () => { + const WALLET1 = ethers.Wallet.createRandom(); + signer1 = new ethers.Wallet(WALLET1.privateKey); + account1 = WALLET1.address; + + const WALLET2 = ethers.Wallet.createRandom(); + signer2 = new ethers.Wallet(WALLET2.privateKey); + account2 = WALLET2.address; + }); + + it('Should subscribe to the channel via V2 without settings', async () => { + const res = await PUSH_CHANNEL.subscribeV2({ + signer: signer1, + channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + userAddress: `eip155:5:${account1}`, + env: Constants.ENV.STAGING, + }); + expect(res.status).to.be.equal('success'); + }); + + it('Should unsubscribe to the channel via V2 without settings', async () => { + const res = await PUSH_CHANNEL.unsubscribeV2({ + signer: signer1, + channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + userAddress: `eip155:5:${account1}`, + env: Constants.ENV.STAGING, + }); + console.log(res) + expect(res.status).to.be.equal('success'); + }); + + it('Should subscribe to the channel via V2 with settings', async () => { + const res = await PUSH_CHANNEL.subscribeV2({ + signer: signer1, + channelAddress: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + userAddress: `eip155:5:${account1}`, + env: Constants.ENV.STAGING, + userSetting: '2-1-0+2-1', + }); + expect(res.status).to.be.equal('success'); + }); +}); diff --git a/packages/restapi/tests/lib/chat/createGroup.test.ts b/packages/restapi/tests/lib/chat/createGroup.test.ts index 5c8db3987..d9ea55a2e 100644 --- a/packages/restapi/tests/lib/chat/createGroup.test.ts +++ b/packages/restapi/tests/lib/chat/createGroup.test.ts @@ -127,8 +127,8 @@ const expectGroup = async ( expect(group.members[0].image).to.be.a('string'); expect(group.pendingMembers).to.be.an('array'); expect(group.pendingMembers.length).to.equal(pendingMembers.length); - expect(group.pendingMembers[0].wallet).to.equal(pendingMembers[0]); - expect(group.pendingMembers[1].wallet).to.equal(pendingMembers[1]); + expect(pendingMembers.includes(group.pendingMembers[0].wallet)).to.be.true; + expect(pendingMembers.includes(group.pendingMembers[1].wallet)).to.be.true; expect(group.groupImage).to.equal(groupImage); expect(group.groupName).to.equal(groupName); expect(group.groupDescription).to.equal(groupDescription); diff --git a/packages/restapi/tests/lib/chat/send.test.ts b/packages/restapi/tests/lib/chat/send.test.ts index fc3e8d0dd..88dba0595 100644 --- a/packages/restapi/tests/lib/chat/send.test.ts +++ b/packages/restapi/tests/lib/chat/send.test.ts @@ -6,7 +6,7 @@ import { ethers } from 'ethers'; import Constants, { MessageType } from '../../../src/lib/constants'; import { upgrade } from '../../../src/lib/user/upgradeUser'; import { decryptPGPKey } from '../../../src/lib/helpers'; -import { createGroup, send } from '../../../src/lib/chat'; +import { approve, createGroup, send } from '../../../src/lib/chat'; import { MessageWithCID, SignerType } from '../../../src/lib/types'; import { decryptAndVerifyMessage } from '../../../src/lib/chat/helpers'; import { @@ -15,10 +15,7 @@ import { colors, uniqueNamesGenerator, } from 'unique-names-generator'; -import { - REACTION_SYMBOL, - REACTION_TYPE, -} from '../../../src/lib/types/messageTypes'; +import { CHAT } from '../../../src/lib/types/messageTypes'; chai.use(chaiAsPromised); const _env = Constants.ENV.DEV; @@ -630,6 +627,232 @@ describe('PushAPI.chat.send', () => { ); }); }); + describe('Video Message', () => { + const MESSAGE_TYPE = MessageType.VIDEO; + const MESSAGE = '{"content":"data:application/mp4;base64,JVBERi0xLjQKJ}'; + it('should throw error using wrong messageObj', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + action: 1, + info: { affected: [] }, + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + // Video message was not supported in v1 & v2 + it('should throw error for deprecated V1', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V2 | EncType - Plaintext', async () => { + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + MESSAGE, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('Deprecated V2 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + MESSAGE, + account1, + _signer1, + account2, + 'pgp' + ); + }); + it('V3 | EncType - Plaintext', async () => { + const msg = await send({ + message: { type: MESSAGE_TYPE, content: MESSAGE }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('V3 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + message: { type: MESSAGE_TYPE, content: MESSAGE }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + }); + describe('Audio Message', () => { + const MESSAGE_TYPE = MessageType.AUDIO; + const MESSAGE = '{"content":"data:application/mp3;base64,JVBERi0xLjQKJ}'; + it('should throw error using wrong messageObj', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + action: 1, + info: { affected: [] }, + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + // Audio message was not supported in v1 & v2 + it('should throw error for deprecated V1', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V2 | EncType - Plaintext', async () => { + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + MESSAGE, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('Deprecated V2 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + MESSAGE, + account1, + _signer1, + account2, + 'pgp' + ); + }); + it('V3 | EncType - Plaintext', async () => { + const msg = await send({ + message: { type: MESSAGE_TYPE, content: MESSAGE }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('V3 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + message: { type: MESSAGE_TYPE, content: MESSAGE }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + }); describe('File Message', () => { const MESSAGE_TYPE = MessageType.FILE; const MESSAGE = '{"content":"data:application/pdf;base64,JVBERi0xLjQKJ}'; @@ -773,8 +996,8 @@ describe('PushAPI.chat.send', () => { ); }); }); - describe('MediaEmbed Message', () => { - const MESSAGE_TYPE = MessageType.MEDIA_EMBED; + describe('GIF Message', () => { + const MESSAGE_TYPE = MessageType.GIF; const MESSAGE = 'ttps://media1.giphy.com/media/FtlUfrq3pVZXVNjoxf/giphy360p.mp4?cid=ecf05e47jk317254v9hbdjrknemduocie4pf54wtsir98xsx&ep=v1_videos_search&rid=giphy360p.mp4&ct=v'; it('should throw error using wrong messageObj', async () => { @@ -917,8 +1140,8 @@ describe('PushAPI.chat.send', () => { ); }); }); - describe('GIF Message', () => { - const MESSAGE_TYPE = MessageType.GIF; + describe('MediaEmbed Message', () => { + const MESSAGE_TYPE = MessageType.MEDIA_EMBED; const MESSAGE = 'ttps://media1.giphy.com/media/FtlUfrq3pVZXVNjoxf/giphy360p.mp4?cid=ecf05e47jk317254v9hbdjrknemduocie4pf54wtsir98xsx&ep=v1_videos_search&rid=giphy360p.mp4&ct=v'; it('should throw error using wrong messageObj', async () => { @@ -1063,7 +1286,7 @@ describe('PushAPI.chat.send', () => { }); describe('Meta Message', () => { const MESSAGE_TYPE = MessageType.META; - const MESSAGE = 'xyz created group PUSH'; + const MESSAGE = CHAT.META.GROUP.CREATE; it('should throw error using messageContent or wrong MessageObject', async () => { await expect( send({ @@ -1087,7 +1310,7 @@ describe('PushAPI.chat.send', () => { await expect( send({ messageType: MESSAGE_TYPE, - messageObj: { content: MESSAGE, reference: '' }, + messageObj: { content: MESSAGE }, messageContent: MESSAGE, receiverAddress: account2, signer: _signer1, @@ -1097,30 +1320,25 @@ describe('PushAPI.chat.send', () => { await expect( send({ messageType: MESSAGE_TYPE, - messageObj: { content: MESSAGE, action: 1 }, // no info provided + messageObj: { content: MESSAGE, action: 1 }, // no info messageContent: MESSAGE, receiverAddress: account2, signer: _signer1, env: _env, }) ).to.be.rejected; - }); - it('should throw error for non-group', async () => { await expect( send({ messageType: MESSAGE_TYPE, - messageObj: { - content: MESSAGE, - action: 1, - info: { affected: [] }, - }, + messageObj: { content: MESSAGE, action: 1, info: { affected: [] } }, // action is not allowed + messageContent: MESSAGE, receiverAddress: account2, signer: _signer1, env: _env, }) ).to.be.rejected; }); - it('should throw error for non member of group', async () => { + it('should throw error for invalid content', async () => { const groupName = uniqueNamesGenerator({ dictionaries: [adjectives, colors, animals], }); @@ -1133,28 +1351,76 @@ describe('PushAPI.chat.send', () => { const group = await createGroup({ groupName, groupDescription, - members: [_nftAccount1, _nftAccount2], + members: [_nftAccount1, _nftAccount2, account2], groupImage, admins: [], // takes signer as admin automatically, add more if you want to isPublic: true, signer: _signer1, env: _env, }); + + await expect( + send({ + messageType: MESSAGE_TYPE, + message: { + type: MESSAGE_TYPE, + content: 'INVALID CONTENT', + info: { affected: [] }, + }, + receiverAddress: group.chatId, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for non-group', async () => { await expect( send({ messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE, - action: 1, info: { affected: [] }, }, - receiverAddress: group.chatId, - signer: _signer2, + receiverAddress: account2, + signer: _signer1, env: _env, }) ).to.be.rejected; }); - it('should throw error for Non-Admin member of group', async () => { + it('should throw error for non member of group', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + + const group = await createGroup({ + groupName, + groupDescription, + members: [_nftAccount1, _nftAccount2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: true, + signer: _signer1, + env: _env, + }); + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, + }, + receiverAddress: group.chatId, + signer: _signer2, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for Non-Admin member of group', async () => { const groupName = uniqueNamesGenerator({ dictionaries: [adjectives, colors, animals], }); @@ -1179,7 +1445,6 @@ describe('PushAPI.chat.send', () => { messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE, - action: 1, info: { affected: [] }, }, receiverAddress: group.chatId, @@ -1212,7 +1477,6 @@ describe('PushAPI.chat.send', () => { messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE, - action: 1, info: { affected: [] }, }, receiverAddress: group.chatId, @@ -1222,7 +1486,7 @@ describe('PushAPI.chat.send', () => { await expectMsg( msg, MESSAGE_TYPE, - { content: MESSAGE, action: 1, info: { affected: [] } }, + { content: MESSAGE, info: { affected: [] } }, account1, _signer1, group.chatId, @@ -1253,7 +1517,6 @@ describe('PushAPI.chat.send', () => { messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE, - action: 1, info: { affected: [] }, }, receiverAddress: group.chatId, @@ -1263,7 +1526,7 @@ describe('PushAPI.chat.send', () => { await expectMsg( msg, MESSAGE_TYPE, - { content: MESSAGE, action: 1, info: { affected: [] } }, + { content: MESSAGE, info: { affected: [] } }, account1, _signer1, group.chatId, @@ -1294,7 +1557,6 @@ describe('PushAPI.chat.send', () => { message: { type: MESSAGE_TYPE, content: MESSAGE, - action: 1, info: { affected: [] }, }, to: group.chatId, @@ -1304,7 +1566,7 @@ describe('PushAPI.chat.send', () => { await expectMsg( msg, MESSAGE_TYPE, - { content: MESSAGE, action: 1, info: { affected: [] } }, + { content: MESSAGE, info: { affected: [] } }, account1, _signer1, group.chatId, @@ -1335,7 +1597,6 @@ describe('PushAPI.chat.send', () => { message: { type: MESSAGE_TYPE, content: MESSAGE, - action: 1, info: { affected: [] }, }, to: group.chatId, @@ -1345,7 +1606,7 @@ describe('PushAPI.chat.send', () => { await expectMsg( msg, MESSAGE_TYPE, - { content: MESSAGE, action: 1, info: { affected: [] } }, + { content: MESSAGE, info: { affected: [] } }, account1, _signer1, group.chatId, @@ -1355,8 +1616,8 @@ describe('PushAPI.chat.send', () => { }); describe('Reaction Message', () => { const MESSAGE_TYPE = MessageType.REACTION; - const MESSAGE = ''; - it('should throw error using messageContent or wrong MessageObject', async () => { + const MESSAGE = CHAT.REACTION.CLAP; + it('should throw error using messageContent on wrong MessageObject', async () => { await expect( send({ messageType: MESSAGE_TYPE, @@ -1370,12 +1631,175 @@ describe('PushAPI.chat.send', () => { send({ messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE, info: { affected: [] } }, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error on wrong content', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: 'Invalid Symbol', + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V1 | EncType - PlainText', async () => { + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('Deprecated V1 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: MESSAGE, // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + it('V2 | EncType - PlainText', async () => { + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: MESSAGE, // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('V2 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + }); + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: MESSAGE, // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + }); + describe('Receipt Message', () => { + const MESSAGE_TYPE = MessageType.RECEIPT; + const MESSAGE = CHAT.RECEIPT.READ; + it('should throw error using messageContent on wrong MessageObject', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, messageContent: MESSAGE, receiverAddress: account2, signer: _signer1, env: _env, }) ).to.be.rejected; + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; await expect( send({ messageType: MESSAGE_TYPE, @@ -1387,12 +1811,29 @@ describe('PushAPI.chat.send', () => { }) ).to.be.rejected; }); + it('should throw error on wrong content', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: 'Invalid Message Content', + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); it('Deprecated V1 | EncType - PlainText', async () => { const msg = await send({ messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE, - action: REACTION_TYPE.THUMBS_UP, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, receiverAddress: walletAddress2, signer: _signer1, @@ -1402,8 +1843,9 @@ describe('PushAPI.chat.send', () => { msg, MESSAGE_TYPE, { - content: REACTION_SYMBOL[REACTION_TYPE.THUMBS_UP], // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL, - action: REACTION_TYPE.THUMBS_UP, + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, account1, _signer1, @@ -1421,7 +1863,8 @@ describe('PushAPI.chat.send', () => { messageType: MESSAGE_TYPE, messageObj: { content: MESSAGE, - action: REACTION_TYPE.THUMBS_UP, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, receiverAddress: walletAddress2, signer: _signer1, @@ -1431,8 +1874,9 @@ describe('PushAPI.chat.send', () => { msg, MESSAGE_TYPE, { - content: REACTION_SYMBOL[REACTION_TYPE.THUMBS_UP], // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL - action: REACTION_TYPE.THUMBS_UP, + content: MESSAGE, // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, account1, _signer1, @@ -1445,7 +1889,8 @@ describe('PushAPI.chat.send', () => { message: { type: MESSAGE_TYPE, content: MESSAGE, - action: REACTION_TYPE.THUMBS_UP, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, to: walletAddress2, signer: _signer1, @@ -1455,8 +1900,9 @@ describe('PushAPI.chat.send', () => { msg, MESSAGE_TYPE, { - content: REACTION_SYMBOL[REACTION_TYPE.THUMBS_UP], // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL, - action: REACTION_TYPE.THUMBS_UP, + content: MESSAGE, // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, account1, _signer1, @@ -1474,7 +1920,8 @@ describe('PushAPI.chat.send', () => { message: { type: MESSAGE_TYPE, content: MESSAGE, - action: REACTION_TYPE.THUMBS_UP, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, to: walletAddress2, signer: _signer1, @@ -1484,8 +1931,9 @@ describe('PushAPI.chat.send', () => { msg, MESSAGE_TYPE, { - content: REACTION_SYMBOL[REACTION_TYPE.THUMBS_UP], // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL - action: REACTION_TYPE.THUMBS_UP, + content: MESSAGE, // REACTION OVERRIDES THE MESSAGE CONTENT TO THE SYMBOL + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', }, account1, _signer1, @@ -1494,21 +1942,817 @@ describe('PushAPI.chat.send', () => { ); }); }); -}); + describe('User Activity Message', () => { + const MESSAGE_TYPE = MessageType.USER_ACTIVITY; + const MESSAGE = CHAT.UA.LISTENER.JOIN; + it('should throw error using messageContent or wrong MessageObject', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE, action: 1 }, // no info + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE, action: 1, info: { affected: [] } }, // action is not allowed + messageContent: MESSAGE, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for invalid content', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; -/** - * HELPER FUNCTION - */ -const expectMsg = async ( - msg: MessageWithCID, - messageType: string, - content: string | { [key: string]: any }, - sender: string, - senderSigner: SignerType, // or receiverSigner - receiver: string, - encType?: 'PlainText' | 'pgp' -): Promise<void> => { - expect(msg.fromDID).to.include(sender); + const group = await createGroup({ + groupName, + groupDescription, + members: [_nftAccount1, _nftAccount2, account2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: true, + signer: _signer1, + env: _env, + }); + + await expect( + send({ + messageType: MESSAGE_TYPE, + message: { + type: MESSAGE_TYPE, + content: 'INVALID CONTENT', + info: { affected: [] }, + }, + receiverAddress: group.chatId, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for non-group', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for non member of group', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + + const group = await createGroup({ + groupName, + groupDescription, + members: [_nftAccount1, _nftAccount2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: true, + signer: _signer1, + env: _env, + }); + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, + }, + receiverAddress: group.chatId, + signer: _signer2, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V1 | EncType - PlainText ( Public Grp )', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + + const group = await createGroup({ + groupName, + groupDescription, + members: [account2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: true, + signer: _signer1, + env: _env, + }); + // approve intent + await approve({ + senderAddress: group.chatId, + status: 'Approved', + account: account2, + signer: _signer2, + env: _env, + }); + // send message + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, + }, + receiverAddress: group.chatId, + signer: _signer2, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE, info: { affected: [] } }, + account2, + _signer2, + group.chatId, + 'PlainText' + ); + }); + it('Deprecated V1 | EncType - pgp ( Private Grp )', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + + const group = await createGroup({ + groupName, + groupDescription, + members: [_nftAccount1, _nftAccount2, account2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: false, + signer: _signer1, + env: _env, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, + }, + receiverAddress: group.chatId, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE, info: { affected: [] } }, + account1, + _signer1, + group.chatId, + 'pgp' + ); + }); + it('V2 | EncType - PlainText ( Public Grp )', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + + const group = await createGroup({ + groupName, + groupDescription, + members: [_nftAccount1, _nftAccount2, account2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: true, + signer: _signer1, + env: _env, + }); + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + info: { affected: [] }, + }, + to: group.chatId, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE, info: { affected: [] } }, + account1, + _signer1, + group.chatId, + 'PlainText' + ); + }); + it('V2 | EncType - pgp ( Private Grp )', async () => { + const groupName = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupDescription = uniqueNamesGenerator({ + dictionaries: [adjectives, colors, animals], + }); + const groupImage = + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg=='; + + const group = await createGroup({ + groupName, + groupDescription, + members: [_nftAccount1, _nftAccount2, account2], + groupImage, + admins: [], // takes signer as admin automatically, add more if you want to + isPublic: false, + signer: _signer1, + env: _env, + }); + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + info: { affected: [] }, + }, + to: group.chatId, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE, info: { affected: [] } }, + account1, + _signer1, + group.chatId, + 'pgp' + ); + }); + }); + describe('Intent Message', () => { + const MESSAGE_TYPE = MessageType.INTENT; + const MESSAGE = CHAT.INTENT.ACCEPT; + it('should throw error using wrong messageObj', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, // not supported for intent + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error using wrong content', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: 'Invalid Message', + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V1 | EncType - Plaintext', async () => { + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + MESSAGE, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('Deprecated V1 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { content: MESSAGE }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + MESSAGE, + account1, + _signer1, + account2, + 'pgp' + ); + }); + it('V2 | EncType - Plaintext', async () => { + const msg = await send({ + message: { type: MESSAGE_TYPE, content: MESSAGE }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('V2 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + message: { type: MESSAGE_TYPE, content: MESSAGE }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { content: MESSAGE }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + }); + describe('Reply Message', () => { + const MESSAGE_TYPE = MessageType.REPLY; + const MESSAGE = { + type: MessageType.TEXT, + content: 'Replying to prev message', + }; + it('should throw error using wrong messageObj', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + // Adding content is legacy format is not allowed for reply + content: { + messageType: MessageType.TEXT, + messageObj: { + content: 'Hey', + }, + }, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error using wrong content', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: 'Invalid Message', + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for unsupported messageType reply', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: { + type: MessageType.RECEIPT, + content: CHAT.RECEIPT.READ, + }, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V1 | EncType - Plaintext', async () => { + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: { + messageType: MESSAGE.type, + messageObj: { content: MESSAGE.content }, + }, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('Deprecated V1 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: { + messageType: MESSAGE.type, + messageObj: { content: MESSAGE.content }, + }, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + it('V2 | EncType - Plaintext', async () => { + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: { + messageType: MESSAGE.type, + messageObj: { content: MESSAGE.content }, + }, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('V2 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: { + messageType: MESSAGE.type, + messageObj: { content: MESSAGE.content }, + }, + reference: + 'bafyreia22girudospfbs3q7t6eelb453rmwsi7shkejwxtwpp57xww6vae', + }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + }); + describe('Composite Message', () => { + const MESSAGE_TYPE = MessageType.COMPOSITE; + const MESSAGE = [ + { + type: MessageType.TEXT as string, + content: 'Replying to prev message', + }, + ]; + it('should throw error using wrong messageObj', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + info: { affected: [] }, // not supported for composite + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error using wrong content', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: 'Invalid Message', + }, + receiverAddress: account2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('should throw error for unsupported messageType composite', async () => { + await expect( + send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: [ + { + type: MessageType.READ_RECEIPT, + content: CHAT.READ_RECEIPT, + }, + ], + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }) + ).to.be.rejected; + }); + it('Deprecated V1 | EncType - Plaintext', async () => { + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: [ + { + messageType: MESSAGE[0].type, + messageObj: { content: MESSAGE[0].content }, + }, + ], + }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('Deprecated V1 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + messageType: MESSAGE_TYPE, + messageObj: { + content: MESSAGE, + }, + receiverAddress: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: [ + { + messageType: MESSAGE[0].type, + messageObj: { content: MESSAGE[0].content }, + }, + ], + }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + it('V2 | EncType - Plaintext', async () => { + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: [ + { + messageType: MESSAGE[0].type, + messageObj: { content: MESSAGE[0].content }, + }, + ], + }, + account1, + _signer1, + account2, + 'PlainText' + ); + }); + it('V2 | EncType - pgp', async () => { + await create({ + account: account2, + env: _env, + signer: _signer2, + version: Constants.ENC_TYPE_V1, + }); + const msg = await send({ + message: { + type: MESSAGE_TYPE, + content: MESSAGE, + }, + to: walletAddress2, + signer: _signer1, + env: _env, + }); + await expectMsg( + msg, + MESSAGE_TYPE, + { + content: [ + { + messageType: MESSAGE[0].type, + messageObj: { content: MESSAGE[0].content }, + }, + ], + }, + account1, + _signer1, + account2, + 'pgp' + ); + }); + }); +}); + +/** + * HELPER FUNCTION + */ +const expectMsg = async ( + msg: MessageWithCID, + messageType: string, + content: string | { [key: string]: any }, + sender: string, + senderSigner: SignerType, // or receiverSigner + receiver: string, + encType?: 'PlainText' | 'pgp' +): Promise<void> => { + expect(msg.fromDID).to.include(sender); expect(msg.fromCAIP10).to.include(sender); expect(msg.toDID).to.include(receiver); expect(msg.toCAIP10).to.include(receiver); @@ -1518,6 +2762,9 @@ const expectMsg = async ( expect(msg.sigType).to.equal(msg.verificationProof?.split(':')[0]); //Backward Compatibility check ( signature signs messageContent and will be diff from vProof ) expect(msg.signature).not.to.equal(msg.verificationProof?.split(':')[1]); + + const unsupportedContent = + 'MessageType Not Supported by this sdk version. Plz upgrade !!!'; try { if (encType && encType === 'pgp') { throw new Error('Should be encrypted'); @@ -1527,11 +2774,14 @@ const expectMsg = async ( if (typeof content === 'string') { expect((msg.messageObj as { content: string }).content).to.equal(content); //Backward Compatibility check - expect(msg.messageContent).to.equal(content); + expect(msg.messageContent).to.be.oneOf([content, unsupportedContent]); } else { expect(msg.messageObj).to.eql(content); //Backward Compatibility check - expect(msg.messageContent).to.equal((content as any).content); + expect(msg.messageContent).to.be.oneOf([ + (content as any).content, + unsupportedContent, + ]); } } catch (err) { if (encType && encType === 'PlainText') { @@ -1557,11 +2807,17 @@ const expectMsg = async ( content ); //Backward Compatibility check - expect(decryptedMsg.messageContent).to.equal(content); + expect(decryptedMsg.messageContent).to.be.oneOf([ + content, + unsupportedContent, + ]); } else { expect(decryptedMsg.messageObj).to.eql(content); //Backward Compatibility check - expect(decryptedMsg.messageContent).to.equal((content as any).content); + expect(decryptedMsg.messageContent).to.be.oneOf([ + (content as any).content, + unsupportedContent, + ]); } } }; diff --git a/packages/restapi/tests/lib/chat/updateGroup.test.ts b/packages/restapi/tests/lib/chat/updateGroup.test.ts index 1ad448a69..5f10b2db5 100644 --- a/packages/restapi/tests/lib/chat/updateGroup.test.ts +++ b/packages/restapi/tests/lib/chat/updateGroup.test.ts @@ -179,7 +179,7 @@ const expectGroup = async ( expect(group.pendingMembers).to.be.an('array'); expect(group.pendingMembers.length).to.equal(pendingMembers.length); for (let i = 0; i < pendingMembers.length; i++) { - expect(group.pendingMembers[i].wallet).to.equal(pendingMembers[i]); + expect(pendingMembers.includes(group.pendingMembers[i].wallet)).to.be.true; } expect(group.groupImage).to.equal(groupImage); expect(group.groupName).to.equal(groupName); @@ -191,7 +191,6 @@ const expectGroup = async ( expect(group.scheduleEnd).to.be.null; expect(group.groupType).to.equal('default'); expect((group as any).status).to.be.null; - expect((group as any).eventType).to.equal('update'); if (!HasMeta) { expect((group as any).meta).to.be.null; } else { diff --git a/packages/restapi/tests/lib/progressHook/progressHook.test.ts b/packages/restapi/tests/lib/progressHook/progressHook.test.ts index 3d177985b..4ea5a4155 100644 --- a/packages/restapi/tests/lib/progressHook/progressHook.test.ts +++ b/packages/restapi/tests/lib/progressHook/progressHook.test.ts @@ -86,14 +86,7 @@ describe('ProgressHook Tests', () => { for (let i = 0; i < progressInfo.length - 1; i++) { expect(progressInfo[i]).to.deep.equal(expectedHooks[i]); } - const expectedErrorHook = { - progressId: 'PUSH-ERROR-00', - progressTitle: 'Non Specific Error', - progressInfo: - '[Push SDK] - API - Error - API create() -: Error: [Push SDK] - API https://backend-dev.epns.io/apis/v2/users/: AxiosError: Request failed with status code 400', - level: 'ERROR', - }; - expect(progressInfo[4]).to.deep.equal(expectedErrorHook); + expect(progressInfo[4].progressId).to.be.equal('PUSH-ERROR-00'); } }); it('Decrypt Push Profile Success ProgressHooks', async () => { diff --git a/packages/restapi/tests/lib/pushNotification/alias.test.ts b/packages/restapi/tests/lib/pushNotification/alias.test.ts new file mode 100644 index 000000000..ae62cf864 --- /dev/null +++ b/packages/restapi/tests/lib/pushNotification/alias.test.ts @@ -0,0 +1,53 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); + +import { PushAPI } from '../../../src/lib/pushapi/PushAPI'; +import { expect } from 'chai'; +import { ethers } from 'ethers'; + +describe('PushAPI.alias functionality', () => { + let userAlice: PushAPI; + let userBob: PushAPI; + let userKate: PushAPI; + let signer1: any; + let account1: string; + let signer2: any; + let account2: string; + + beforeEach(async () => { + signer1 = new ethers.Wallet(`0x${process.env['WALLET_PRIVATE_KEY']}`); + account1 = await signer1.getAddress(); + + const provider = new ethers.providers.JsonRpcProvider( + // PUBLIC RPC + 'https://goerli.blockpi.network/v1/rpc/public' + ); + + signer2 = new ethers.Wallet( + `0x${process.env['WALLET_PRIVATE_KEY']}`, + provider + ); + account2 = await signer2.getAddress(); + + // initialisation with signer and provider + userKate = await PushAPI.initialize(signer2); + // initialisation with signer + userAlice = await PushAPI.initialize(signer2); + // TODO: remove signer1 after chat makes signer as optional + //initialisation without signer + userBob = await PushAPI.initialize(signer1); + }); + + describe('alias :: info', () => { + // TODO: remove skip after signer becomes optional + it('Should return response', async () => { + const res = await userBob.channel.alias.info({ + alias: '0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + aliasChain: 'POLYGON', + }); + // console.log(res) + expect(res).not.null; + }); + }); +}); diff --git a/packages/restapi/tests/lib/pushNotification/channel.test.ts b/packages/restapi/tests/lib/pushNotification/channel.test.ts new file mode 100644 index 000000000..677d4ac8d --- /dev/null +++ b/packages/restapi/tests/lib/pushNotification/channel.test.ts @@ -0,0 +1,298 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); + +import { PushAPI } from '../../../src/lib/pushapi/PushAPI'; +import { expect } from 'chai'; +import { ethers } from 'ethers'; + +describe('PushAPI.channel functionality', () => { + let userAlice: PushAPI; + let userBob: PushAPI; + let userKate: PushAPI; + let signer1: any; + let account1: string; + let signer2: any; + let account2: string; + + beforeEach(async () => { + signer1 = new ethers.Wallet(`0x${process.env['WALLET_PRIVATE_KEY']}`); + account1 = await signer1.getAddress(); + + const provider = new ethers.providers.JsonRpcProvider( + // PUBLIC RPC + 'https://goerli.blockpi.network/v1/rpc/public' + ); + + signer2 = new ethers.Wallet( + `0x${process.env['WALLET_PRIVATE_KEY']}`, + provider + ); + account2 = await signer2.getAddress(); + enum ENV { + PROD = 'prod', + STAGING = 'staging', + DEV = 'dev', + /** + * **This is for local development only** + */ + LOCAL = 'local', + } + // initialisation with signer and provider + userKate = await PushAPI.initialize(signer2, {env: ENV.DEV}) + // initialisation with signer + userAlice = await PushAPI.initialize(signer2); + // TODO: remove signer1 after chat makes signer as optional + //initialisation without signer + userBob = await PushAPI.initialize(signer1); + }); + + describe('channel :: info', () => { + // TODO: remove skip after signer becomes optional + it.skip('Without signer and account: Should throw error', async () => { + await expect(() => userBob.channel.info()).to.Throw; + }); + + it('Without signer but with non-caip account: Should return response', async () => { + const res = await userBob.channel.info( + '0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5' + ); + // console.log(res) + expect(res).not.null; + }); + + it('Without signer and with valid caip account: Should return response', async () => { + const res = await userBob.channel.info( + 'eip155:5:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5' + ); + // console.log(res); + expect(res).not.null; + }); + }); + + describe('channel :: search', () => { + it('Without signer and account : Should return response', async () => { + const res = await userBob.channel.search(' '); + // console.log(res); + expect(res).not.null; + }); + + it('With signer: Should return response', async () => { + const res = await userBob.channel.search(' '); + // console.log(res); + expect(res).not.null; + }); + + it('Should throw error for empty query', async () => { + // const res = await userBob.channel.search('') + await expect(() => userBob.channel.search('')).to.Throw; + }); + }); + + describe('channel :: subscribers', () => { + // TODO: remove skip after signer becomes optional + it.skip('Without signer and account : Should throw error', async () => { + await expect(() => userBob.channel.subscribers()).to.Throw; + }); + + it('Without signer and account : Should return response as address is passed', async () => { + const res = await userBob.channel.subscribers({ + channel: 'eip155:5:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + }); + // console.log(res) + expect(res).not.null; + }); + + it('Without signer and account : Should return response for alias address', async () => { + const res = await userBob.channel.subscribers({ + channel: 'eip155:80001:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + }); + // console.log(res) + expect(res).not.null; + }); + + it('Without signer and account : Should return response without passing the options', async () => { + const res = await userKate.channel.subscribers(); + expect(res).not.null; + }); + + it('Without signer and account : Should throw error for invalid caip', async () => { + await expect(() => + userBob.channel.subscribers({ + channel: '0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + }) + ).to.Throw; + }); + }); + + describe('channel :: send', () => { + // TODO: remove skip after signer becomes optional + it.skip('Without signer and account : Should throw error', async () => { + await expect(() => { + userBob.channel.send(['*'], { + notification: { + title: 'test', + body: 'test', + }, + }); + }).to.Throw; + }); + + it('With signer : broadcast : Should send notification with title and body', async () => { + const res = await userAlice.channel.send(['*'], { + notification: { + title: 'test', + body: 'test', + }, + }); + // console.log(res) + expect(res.status).to.equal(204); + }); + + it('With signer : targeted : Should send notification with title and body', async () => { + const res = await userAlice.channel.send( + ['eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681'], + { + notification: { + title: 'hi', + body: 'test-targeted', + }, + } + ); + expect(res.status).to.equal(204); + }); + + it('With signer : targeted : Should send notification with title and body', async () => { + const res = await userAlice.channel.send( + ['eip155:5:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5'], + { + notification: { + title: 'hi', + body: 'test-targeted', + }, + } + ); + expect(res.status).to.equal(204); + }); + + it('With signer : subset : Should send notification with title and body', async () => { + const res = await userAlice.channel.send( + [ + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + 'eip155:5:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + ], + { + notification: { + title: 'hi', + body: 'test-targeted', + }, + } + ); + expect(res.status).to.equal(204); + }); + + it('With signer : subset : Should send notification with title and body along with additional options', async () => { + const res = await userAlice.channel.send( + [ + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + 'eip155:5:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + ], + { + notification: { + title: 'hi', + body: 'test-targeted', + }, + payload: { + title: 'testing first notification', + body: 'testing with random body', + cta: 'https://google.com/', + embed: 'https://avatars.githubusercontent.com/u/64157541?s=200&v=4', + }, + } + ); + expect(res.status).to.equal(204); + }); + + it('With signer : subset : Should send notification with title and body along with additional options', async () => { + const res = await userAlice.channel.send( + [ + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + 'eip155:5:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + ], + { + notification: { + title: 'hi', + body: 'test-subset', + }, + payload: { + title: 'testing first subset notification', + body: 'testing with random body', + cta: 'https://google.com/', + embed: 'https://avatars.githubusercontent.com/u/64157541?s=200&v=4', + }, + } + ); + expect(res.status).to.equal(204); + }); + + it('With signer : subset : Should send notification with title and body along with additional options for alias', async () => { + const res = await userAlice.channel.send( + [ + 'eip155:97:0xD8634C39BBFd4033c0d3289C4515275102423681', + 'eip155:97:0x93A829d16DE51745Db0530A0F8E8A9B8CA5370E5', + ], + { + notification: { + title: 'hi', + body: 'test-subset', + }, + payload: { + title: 'testing first subset notification', + body: 'testing with random body', + cta: 'https://google.com/', + embed: 'https://avatars.githubusercontent.com/u/64157541?s=200&v=4', + }, + channel: 'eip155:97:0xD8634C39BBFd4033c0d3289C4515275102423681', + } + ); + expect(res.status).to.equal(204); + }); + }); + + describe.skip('channel :: update', () => { + it('Should update channel meta', async () => { + const res = await userKate.channel.update({ + name: 'Updated Name', + description: 'Testing new description', + url: 'https://google.com', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + }); + // console.log(res) + expect(res).not.null; + }, 10000000000); + }); + + describe.skip('channel :: create', () => { + it('Should create channel', async () => { + const res = await userKate.channel.create({ + name: 'SDK Test', + description: 'Testing new description', + url: 'https://google.com', + icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAz0lEQVR4AcXBsU0EQQyG0e+saWJ7oACiKYDMEZVs6GgSpC2BIhzRwAS0sgk9HKn3gpFOAv3v3V4/3+4U4Z1q5KTy42Ql940qvFONnFSGmCFmiN2+fj7uCBlihpgh1ngwcvKfwjuVIWaIGWKNB+GdauSk8uNkJfeNKryzYogZYoZY40m5b/wlQ8wQM8TayMlKeKcaOVkJ71QjJyuGmCFmiDUe+HFy4VyEd57hx0mV+0ZliBlihlgL71w4FyMnVXhnZeSkiu93qheuDDFDzBD7BcCyMAOfy204AAAAAElFTkSuQmCC', + }); + // console.log(res) + expect(res).not.null; + }, 10000000000); + }); + + describe.skip('channel :: settings', () => { + it('Should create channel', async () => { + const res = await userKate.channel.setting([ + { type: 1, default: 1, description: 'My Notif Settings' }, + {type: 2, default: 5, description: "My notif setting 2", data: {upper:100, lower:5, ticker: 10}} + ]); + // console.log(res) + expect(res).not.null; + }, 10000000000); + }); +}); diff --git a/packages/restapi/tests/lib/pushNotification/delegate.test.ts b/packages/restapi/tests/lib/pushNotification/delegate.test.ts new file mode 100644 index 000000000..bc43c9986 --- /dev/null +++ b/packages/restapi/tests/lib/pushNotification/delegate.test.ts @@ -0,0 +1,180 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); + +import { PushAPI } from '../../../src/lib/pushapi/PushAPI'; // Ensure correct import path +import { expect } from 'chai'; +import { ethers } from 'ethers'; +// import tokenABI from './tokenABI'; +describe('PushAPI.delegate functionality', () => { + let userAlice: PushAPI; + let userBob: PushAPI; + let userKate: PushAPI; + let signer1: any; + let account1: string; + let signer2: any; + let account2: string; + + beforeEach(async () => { + signer1 = new ethers.Wallet(`0x${process.env['WALLET_PRIVATE_KEY']}`); + account1 = await signer1.getAddress(); + + const provider = new ethers.providers.JsonRpcProvider( + 'https://goerli.blockpi.network/v1/rpc/public' + ); + + signer2 = new ethers.Wallet( + `0x${process.env['WALLET_PRIVATE_KEY']}`, + provider + ); + account2 = await signer2.getAddress(); + + // initialisation with signer and provider + userKate = await PushAPI.initialize(signer2); + // initialisation with signer + userAlice = await PushAPI.initialize(signer1); + // initialisation without signer + userBob = await PushAPI.initialize(signer1); + }); + + describe('delegate :: add', () => { + // TODO: remove skip after signer becomes optional + it.skip('Without signer and account :: should throw error', async () => { + await expect(() => + userBob.channel.delegate.add( + 'eip155:5:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ) + ).to.Throw; + }); + + it('With signer and without provider :: should throw error', async () => { + await expect(() => + userAlice.channel.delegate.add( + 'eip155:5:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ) + ).to.Throw; + }); + + it('With signer and provider :: should add delegate', async () => { + const res = await userKate.channel.delegate.add( + 'eip155:5:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ); + // console.log(res); + expect(res).not.null; + }, 100000000); + + it('With signer and provider :: should throw error as delegate caip and provider doesnt match', async () => { + await expect(() => + userKate.channel.delegate.add( + 'eip155:80001:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ) + ).to.Throw; + }); + + it('With viem signer: Should add delegate', async () => { + // create polygon mumbai provider + const provider = new ethers.providers.JsonRpcProvider( + 'https://rpc-mumbai.maticvigil.com' + ); + + signer2 = new ethers.Wallet( + `0x${process.env['WALLET_PRIVATE_KEY']}`, + provider + ); + userKate = await PushAPI.initialize(signer2); + const res = await userKate.channel.delegate.add( + 'eip155:80001:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ); + // console.log(res); + expect(res).not.null; + }, 10000000); + }); + + describe('delegate :: remove', () => { + // TODO: remove skip after signer becomes optional + it.skip('Without signer and account :: should throw error', async () => { + await expect(() => + userBob.channel.delegate.remove( + 'eip155:5:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ) + ).to.Throw; + }); + + it('With signer and without provider :: should throw error', async () => { + await expect(() => + userAlice.channel.delegate.remove( + 'eip155:5:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ) + ).to.Throw; + }); + + it('With signer and provider :: should add delegate', async () => { + const res = await userKate.channel.delegate.remove( + 'eip155:5:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ); + console.log(res); + expect(res).not.null; + }, 100000000); + + it('With signer and provider :: should throw error as delegate caip and provider doesnt match', async () => { + await expect(() => + userKate.channel.delegate.remove( + 'eip155:80001:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ) + ).to.Throw; + }); + + it('With viem signer: Should remove delegate', async () => { + // create polygon mumbai provider + const provider = new ethers.providers.JsonRpcProvider( + 'https://rpc-mumbai.maticvigil.com' + ); + + signer2 = new ethers.Wallet( + `0x${process.env['WALLET_PRIVATE_KEY']}`, + provider + ); + userKate = await PushAPI.initialize(signer2); + const res = await userKate.channel.delegate.remove( + 'eip155:80001:0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924' + ); + // console.log(res); + expect(res).not.null; + }, 10000000); + }); + + describe('delegate :: get', () => { + it.skip('Without signer and account : Should throw error', async () => { + await expect(() => userBob.channel.delegate.get()).to.Throw; + }); + it('Without signer : Should throw error for non-caip format', async () => { + await expect(() => + userBob.channel.delegate.get({ + channel: '0x74415Bc4C4Bf4Baecc2DD372426F0a1D016Fa924', + }) + ).to.Throw; + }); + + it('Without signer : Should fetch delegates', async () => { + const res = await userBob.channel.delegate.get({ + channel: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + }); + console.log(res); + expect(res).not.null; + }); + + it('Without signer : Should fetch delegates for alias', async () => { + const res = await userBob.channel.delegate.get({ + channel: 'eip155:80001:0xD8634C39BBFd4033c0d3289C4515275102423681', + }); + // console.log(res) + expect(res).not.null; + }); + + it('With signer : Should fetch delegates for channel', async () => { + const res = await userKate.channel.delegate.get(); + // console.log(res); + expect(res).not.null; + }); + }); +}); diff --git a/packages/restapi/tests/lib/pushNotification/notification.test.ts b/packages/restapi/tests/lib/pushNotification/notification.test.ts new file mode 100644 index 000000000..a72d37db3 --- /dev/null +++ b/packages/restapi/tests/lib/pushNotification/notification.test.ts @@ -0,0 +1,207 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); + +import { PushAPI } from '../../../src/lib/pushapi/PushAPI'; // Ensure correct import path +import { expect } from 'chai'; +import { ethers } from 'ethers'; +import { createWalletClient, http } from 'viem'; +import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +import { goerli } from 'viem/chains'; +// import tokenABI from './tokenABI'; +describe('PushAPI.notification functionality', () => { + let userAlice: PushAPI; + let userBob: PushAPI; + let userKate: PushAPI; + let signer1: any; + let account1: string; + let signer2: any; + let account2: string; + let viemSigner: any; + let userViem: PushAPI; + beforeEach(async () => { + signer1 = new ethers.Wallet( + `0x${process.env['NFT_HOLDER_WALLET_PRIVATE_KEY_1']}` + ); + account1 = await signer1.getAddress(); + + const provider = new ethers.providers.JsonRpcProvider( + 'https://goerli.blockpi.network/v1/rpc/public' + ); + + signer2 = new ethers.Wallet( + `0x${process.env['NFT_HOLDER_WALLET_PRIVATE_KEY_1']}`, + provider + ); + account2 = await signer2.getAddress(); + viemSigner = createWalletClient({ + account: privateKeyToAccount( + `0x${process.env['NFT_HOLDER_WALLET_PRIVATE_KEY_1']}` + ), + chain: goerli, + transport: http(), + }); + // initialisation with signer and provider + userKate = await PushAPI.initialize(signer2); + // initialisation with signer + userAlice = await PushAPI.initialize(signer1); + // TODO: remove signer1 after signer becomes optional + // initialisation without signer + userBob = await PushAPI.initialize(signer1); + // initialisation with viem + userViem = await PushAPI.initialize(viemSigner); + }); + + describe('PushAPI.notification functionality', () => { + it('Should return feeds with signer object', async () => { + const response = await userAlice.notification.list('SPAM'); + expect(response).not.null; + }); + + it('Should return feeds with signer object when an account is passed', async () => { + const response = await userAlice.notification.list('SPAM', { + account: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + }); + expect(response).not.null; + expect(response.length).not.equal(0); + }); + + it('Should return feeds without signer object when an account is passed', async () => { + const response = await userBob.notification.list('SPAM', { + account: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + }); + expect(response).not.null; + expect(response.length).not.equal(0); + }); + + it.skip('Should throw error without signer object when an account is not passed', async () => { + await expect(() => userBob.notification.list('SPAM')).to.Throw; + }); + + it('Should return feeds when signer with provider is used', async () => { + const response = await userKate.notification.list('SPAM'); + expect(response).not.null; + }); + + it('Should return feeds when viem is used', async () => { + const response = await userViem.notification.list('SPAM'); + console.log(response) + expect(response).not.null; + }); + + it('Should return feeds when signer with provider is used', async () => { + const response = await userKate.notification.list('INBOX', { + account: 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681', + channels: ['0xD8634C39BBFd4033c0d3289C4515275102423681'], + raw: true, + }); + // console.log(response) + expect(response).not.null; + }); + }); + + describe('notification :: subscribe', () => { + beforeEach(async () => { + await userAlice.notification.unsubscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + + await userKate.notification.unsubscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + }); + + afterEach(async () => { + await userAlice.notification.unsubscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + + await userKate.notification.unsubscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + }); + it.skip('Without signer object: should throw error', async () => { + await expect(() => + userBob.notification.subscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ) + ).to.Throw; + }); + + it.skip('With signer object: should throw error for invalid channel caip', async () => { + await expect(() => { + userAlice.notification.subscribe( + '0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + }).to.Throw; + }); + + it('With signer object: Should subscribe', async () => { + const res = await userAlice.notification.subscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + // console.log(res) + expect(res).not.null; + }); + + it('With signer and provider: Should subscribe', async () => { + const res = await userKate.notification.subscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + // console.log(res) + expect(res).not.null; + }); + + it('With viem signer and provider: Should subscribe', async () => { + const res = await userViem.notification.subscribe( + 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + ); + // console.log(res) + expect(res).not.null; + }); + }); + + describe('notification :: subscriptions', () => { + it.skip('No signer or account: Should throw error', async () => { + await expect(() => userBob.notification.subscriptions()).to.Throw; + }); + + it('Signer with no account: Should return response', async () => { + const response = await userAlice.notification.subscriptions(); + console.log(response); + expect(response).not.null; + }); + + it('Signer with account: Should return response', async () => { + const response = await userAlice.notification.subscriptions({ + account: 'eip155:80001:0xD8634C39BBFd4033c0d3289C4515275102423681', + }); + // console.log(response); + expect(response).not.null; + expect(response.lenth).not.equal(0); + }); + }); + + // TO RUN THIS, MAKE THE PRIVATE FUNTIONS PUBLIC + // describe('debug :: test private functions', () => { + // it('Fetching data from contract', async () => { + // const contract = userKate.createContractInstance( + // '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + // tokenABI + // ); + // const balance = await contract['balanceOf']( + // '0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(balance.toString()); + // const fees = ethers.utils.parseUnits('50', 18); + // console.log(fees) + // console.log(fees.lte(balance)) + // }); + + // it("Uploading data to ipfs via push node", async () => { + // await userAlice.uploadToIPFSViaPushNode("test") + // }) + + + }); +// }); diff --git a/packages/restapi/tests/lib/pushNotification/onchain.test.ts b/packages/restapi/tests/lib/pushNotification/onchain.test.ts new file mode 100644 index 000000000..faaf15126 --- /dev/null +++ b/packages/restapi/tests/lib/pushNotification/onchain.test.ts @@ -0,0 +1,242 @@ +// import * as path from 'path'; +// import * as dotenv from 'dotenv'; +// dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); +// import { expect } from 'chai'; +// import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; +// import { PushNotificationBaseClass } from '../../../src/lib/pushNotification/pushNotificationBase'; +// import * as config from '../../../src/lib/config'; +// import { +// createWalletClient, +// http, +// getContract, +// createPublicClient, +// } from 'viem'; +// import { abi } from './tokenABI'; +// import { goerli, polygonMumbai } from 'viem/chains'; +// import { BigNumber, ethers } from 'ethers'; + +// enum ENV { +// PROD = 'prod', +// STAGING = 'staging', +// DEV = 'dev', +// /** +// * **This is for local development only** +// */ +// LOCAL = 'local', +// } +// describe.only('test', () => { +// const signer = createWalletClient({ +// account: privateKeyToAccount(`0x${process.env['WALLET_PRIVATE_KEY']}`), +// chain: goerli, +// transport: http('https://goerli.blockpi.network/v1/rpc/public'), +// }); + +// const signer3 = createWalletClient({ +// account: privateKeyToAccount(`0x${process.env['WALLET_PRIVATE_KEY']}`), +// chain: polygonMumbai, +// transport: http(), +// }); + +// const provider = new ethers.providers.JsonRpcProvider( +// 'https://goerli.blockpi.network/v1/rpc/public' +// ); +// const signer2 = new ethers.Wallet( +// `0x${process.env['WALLET_PRIVATE_KEY']}`, +// provider +// ); + +// it.only('Test minimal conversion', async () => { +// const account2 = await signer2.getAddress(); +// const viemUser = new PushNotificationBaseClass( +// signer, +// ENV.STAGING, +// account2 +// ); +// viemUser.getMinimalUserSetting([ +// { enabled: true }, +// { enabled: false, value: 10 }, +// { enabled: false }, +// { enabled: true, value: 10 }, +// ]); +// }); + // it('testing with viem', async () => { + // const account2 = await signer2.getAddress(); + // const viemUser = new PushNotificationBaseClass(signer, ENV.STAGING, account2) + // const contract = viemUser.createContractInstance("0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C", config.ABIS.CORE, goerli) + // const res = await viemUser.fetchUpdateCounter(contract, account2); + // console.log(res) + // const viemContract = await userViem.createContractInstance( + // '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + // abi, + // goerli + // ); + // const balance = await userViem.fetchBalance( + // viemContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(balance); + // const allowance = await userViem.fetchAllownace( + // viemContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681', + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C' + // ); + // console.log(allowance); + // const approveAmount = ethers.BigNumber.from(10000); + // const approveRes = await userViem.approveToken( + // viemContract, + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C', + // approveAmount + // ); + // console.log(approveRes); + + // const addDelegate = await userViem.delegate.add( + // 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(addDelegate); + // }); + + // it.only('test with ethers', async () => { + // const account2 = await signer2.getAddress(); + // const userEthers = new PushNotificationBaseClass(signer2, ENV.STAGING, account2,); + // const contract = userEthers.createContractInstance("0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C", config.ABIS.CORE, goerli) + // const res = await userEthers.fetchUpdateCounter(contract, account2); + // console.log(res) + // const ethersContract = await userEthers.createContractInstance( + // '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + // abi, + // goerli + // ); + // const balance2 = await userEthers.fetchBalance( + // ethersContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(balance2); + // const allowance2 = await userEthers.fetchAllownace( + // ethersContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681', + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C' + // ); + // console.log(allowance2); + // const approveAmount2 = ethers.BigNumber.from(10000); + // const approveRes2 = await userEthers.approveToken( + // ethersContract, + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C', + // approveAmount2 + // ); + // console.log(approveRes2); + // }); +// it.only('Should get proper minnimal payload', async() => { +// const inputData = [ +// { +// type: 0, +// default: 1, +// description: 'test1', +// }, +// { +// type: 1, +// default: 10, +// description: 'test2', +// data: { +// upper: 100, +// lower: 1, + +// ticker: 10 +// }, +// }, +// ]; +// const account2 = await signer2.getAddress(); +// const userAlice = new PushNotificationBaseClass(signer2, ENV.STAGING, account2,); +// const minimalSettings = userAlice.getMinimalSetting(inputData); +// console.log(minimalSettings); +// }); + +// it.only('Should get proper minnimal payload', async() => { +// const inputData = [ +// { +// type: 1, +// default: 10, +// description: 'test2', +// data: { +// upper: 100, +// lower: 1, +// enabled: false +// }, +// }, +// { +// type: 0, +// default: 1, +// description: 'test1', +// }, +// ]; +// const account2 = await signer2.getAddress(); +// const userAlice = new PushNotificationBaseClass(signer2, ENV.STAGING, account2,); +// const minimalSettings = userAlice.getMinimalSetting(inputData); +// console.log(minimalSettings); +// }); + // it('testing with viem', async () => { + // const account2 = await signer2.getAddress(); + // const viemUser = new PushNotificationBaseClass(signer, ENV.STAGING, account2) + // const contract = viemUser.createContractInstance("0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C", config.ABIS.CORE, goerli) + // const res = await viemUser.fetchUpdateCounter(contract, account2); + // console.log(res) + // const viemContract = await userViem.createContractInstance( + // '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + // abi, + // goerli + // ); + // const balance = await userViem.fetchBalance( + // viemContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(balance); + // const allowance = await userViem.fetchAllownace( + // viemContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681', + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C' + // ); + // console.log(allowance); + // const approveAmount = ethers.BigNumber.from(10000); + // const approveRes = await userViem.approveToken( + // viemContract, + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C', + // approveAmount + // ); + // console.log(approveRes); + + // const addDelegate = await userViem.delegate.add( + // 'eip155:5:0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(addDelegate); + // }); + + // it.only('test with ethers', async () => { + // const account2 = await signer2.getAddress(); + // const userEthers = new PushNotificationBaseClass(signer2, ENV.STAGING, account2,); + // const contract = userEthers.createContractInstance("0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C", config.ABIS.CORE, goerli) + // const res = await userEthers.fetchUpdateCounter(contract, account2); + // console.log(res) + // const ethersContract = await userEthers.createContractInstance( + // '0x2b9bE9259a4F5Ba6344c1b1c07911539642a2D33', + // abi, + // goerli + // ); + // const balance2 = await userEthers.fetchBalance( + // ethersContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681' + // ); + // console.log(balance2); + // const allowance2 = await userEthers.fetchAllownace( + // ethersContract, + // '0xD8634C39BBFd4033c0d3289C4515275102423681', + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C' + // ); + // console.log(allowance2); + // const approveAmount2 = ethers.BigNumber.from(10000); + // const approveRes2 = await userEthers.approveToken( + // ethersContract, + // '0xd4E3ceC407cD36d9e3767cD189ccCaFBF549202C', + // approveAmount2 + // ); + // console.log(approveRes2); + // }); +// }); diff --git a/packages/restapi/tests/lib/pushNotification/tokenABI.ts b/packages/restapi/tests/lib/pushNotification/tokenABI.ts new file mode 100644 index 000000000..0f602271d --- /dev/null +++ b/packages/restapi/tests/lib/pushNotification/tokenABI.ts @@ -0,0 +1,709 @@ +export const abi = [ + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "holder", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "weight", + "type": "uint256" + } + ], + "name": "HolderWeightChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "DELEGATION_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rawAmount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "born", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "rawAmount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint96", + "name": "votes", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getCurrentVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "blockNumber", + "type": "uint256" + } + ], + "name": "getPriorVotes", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "holderDelegation", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "holderWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rawAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "holder", + "type": "address" + } + ], + "name": "resetHolderWeight", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "returnHolderDelegation", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "returnHolderRatio", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "bool", + "name": "value", + "type": "bool" + } + ], + "name": "setHolderDelegation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rawAmount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "src", + "type": "address" + }, + { + "internalType": "address", + "name": "dst", + "type": "address" + }, + { + "internalType": "uint256", + "name": "rawAmount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ] as const \ No newline at end of file diff --git a/packages/restapi/tests/lib/pushapi/chat.test.ts b/packages/restapi/tests/lib/pushapi/chat.test.ts index b7ebbf683..c98e3e0ca 100644 --- a/packages/restapi/tests/lib/pushapi/chat.test.ts +++ b/packages/restapi/tests/lib/pushapi/chat.test.ts @@ -52,4 +52,15 @@ describe('PushAPI.chat functionality', () => { }); expect(response).to.be.an('object'); }); + it('Should decrypt message ', async () => { + await userAlice.chat.send(account2, { + content: 'Hello', + type: MessageType.TEXT, + }); + const messagePayloads = await userAlice.chat.history(account2); + const decryptedMessagePayloads = await userBob.chat.decrypt( + messagePayloads + ); + expect(decryptedMessagePayloads).to.be.an('array'); + }); }); diff --git a/packages/restapi/tests/lib/pushstream/initialize.test.ts b/packages/restapi/tests/lib/pushstream/initialize.test.ts new file mode 100644 index 000000000..9ae1527f6 --- /dev/null +++ b/packages/restapi/tests/lib/pushstream/initialize.test.ts @@ -0,0 +1,369 @@ +import * as path from 'path'; +import * as dotenv from 'dotenv'; +dotenv.config({ path: path.resolve(__dirname, '../../.env') }); +import { expect } from 'chai'; // Assuming you're using chai for assertions +import { ethers } from 'ethers'; +import { PushAPI } from '../../../src/lib/pushapi/PushAPI'; +import { sendNotification } from '../../../src/lib/payloads/sendNotifications'; +import { subscribe, unsubscribe } from '../../../src/lib/channels'; + +import { ENV } from '../../../src/lib/constants'; +import { STREAM } from '../../../src/lib/pushstream/pushStreamTypes'; +import * as util from 'util'; +import { ConditionType } from '../../../src/lib'; + +describe('PushStream.initialize functionality', () => { + it('Should initialize new stream and listen to events', async () => { + const MESSAGE = 'Hey There!!!'; + + const provider = ethers.getDefaultProvider(); + + const WALLET = ethers.Wallet.createRandom(); + const signer = new ethers.Wallet(WALLET.privateKey, provider); + const user = await PushAPI.initialize(signer, { + env: ENV.LOCAL, + streamOptions: { raw: true }, + }); + + const WALLET2 = ethers.Wallet.createRandom(); + const signer2 = new ethers.Wallet(WALLET2.privateKey, provider); + const user2 = await PushAPI.initialize(signer2, { + env: ENV.LOCAL, + }); + + const WALLET3 = ethers.Wallet.createRandom(); + const signer3 = new ethers.Wallet(WALLET3.privateKey, provider); + const user3 = await PushAPI.initialize(signer3, { + env: ENV.LOCAL, + }); + + const WALLET4 = ethers.Wallet.createRandom(); + const signer4 = new ethers.Wallet(WALLET4.privateKey, provider); + const user4 = await PushAPI.initialize(signer4, { + env: ENV.LOCAL, + }); + + const GROUP_RULES = { + entry: { + conditions: [ + { + any: [ + { + type: 'PUSH', + category: 'CustomEndpoint', + subcategory: 'GET', + data: { + url: 'https://api.ud-staging.com/profile/badges/dead_pixel/validate/{{user_address}}?rule=join', + }, + }, + ], + }, + ], + }, + chat: { + conditions: [ + { + any: [ + { + type: 'PUSH', + category: 'CustomEndpoint', + subcategory: 'GET', + data: { + url: 'https://api.ud-staging.com/profile/badges/dead_pixel/validate/{{user_address}}?rule=chat', + }, + }, + ], + }, + ], + }, + }; + + const CREATE_GROUP_REQUEST = { + description: 'test', + image: 'test', + members: [], + admins: [], + private: false, + rules: { + chat: { + conditions: { + any: [ + { + type: ConditionType.PUSH, + category: 'ERC20', + subcategory: 'holder', + data: { + contract: + 'eip155:1:0xf418588522d5dd018b425E472991E52EBBeEEEEE', + amount: 1, + decimals: 18, + }, + }, + { + type: ConditionType.PUSH, + category: 'INVITE', + subcategory: 'DEFAULT', + data: { + inviterRoles: ['ADMIN', 'OWNER'], + }, + }, + ], + }, + }, + }, + }; + + const CREATE_GROUP_REQUEST_2 = { + description: 'test', + image: 'test', + members: [], + admins: [], + private: false, + rules: {}, + }; + + const stream = user.stream; + + const createEventPromise = ( + expectedEvent: string, + eventType: string, + expectedEventCount: number + ) => { + return new Promise((resolve, reject) => { + let eventCount = 0; + if (expectedEventCount == 0) { + resolve('Done'); + } + const receivedEvents: any[] = []; + stream.on(eventType, (data: any) => { + try { + receivedEvents.push(data); + eventCount++; + + console.log( + `Event ${eventCount} for ${expectedEvent}:`, + util.inspect(JSON.stringify(data), { + showHidden: false, + depth: null, + colors: true, + }) + ); + expect(data).to.not.be.null; + + if (eventCount === expectedEventCount) { + resolve(receivedEvents); + } + } catch (error) { + console.error('An error occurred:', error); + reject(error); + } + }); + }); + }; + + // leave admin bug + // group creator check remove add + + const onDataReceived = createEventPromise('CHAT_OPS', STREAM.CHAT_OPS, 5); + const onMessageReceived = createEventPromise('CHAT', STREAM.CHAT, 4); + const onNoitificationsReceived = createEventPromise('NOTIF', STREAM.NOTIF, 4); + + // Create and update group + const createdGroup = await user.chat.group.create( + 'test', + CREATE_GROUP_REQUEST_2 + ); + + const updatedGroup = await user.chat.group.update(createdGroup.chatId, { + description: 'Updated Description', + }); + + const updatedGroup2 = await user.chat.group.add(createdGroup.chatId, { + role: 'ADMIN', + accounts: [signer2.address, signer3.address, signer4.address], + }); + + const w2wRejectRequest = await user2.chat.group.join( + createdGroup.chatId + ); + + + + /*const w2wMessageResponse = await user2.chat.send(signer.address, { + content: MESSAGE, + }); + const w2wAcceptsRequest = await user.chat.accept(signer2.address); + + const w2wMessageResponse2 = await user2.chat.send(signer.address, { + content: MESSAGE, + });*/ + + /*const channelPrivateKey = process.env['WALLET_PRIVATE_KEY']; + + const signerChannel = new ethers.Wallet(`0x${channelPrivateKey}`); + const channelAddress = signerChannel.address; + + console.log(channelAddress); + + const response = await subscribe({ + signer: signer, + channelAddress: `eip155:5:${channelAddress}`, // channel address in CAIP + userAddress: `eip155:5:${signer.address}`, // user address in CAIP + onSuccess: () => { + console.log('opt in success'); + }, + onError: () => { + console.error('opt in error'); + }, + env: ENV.LOCAL, + }); + + + const apiResponse = await sendNotification({ + signer: signerChannel, // Needs to resolve to channel address + type: 1, // broadcast + identityType: 2, // direct payload + notification: { + title: `notification TITLE:`, + body: `notification BODY`, + }, + payload: { + title: `payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + channel: `eip155:5:${channelAddress}`, // your channel address + env: ENV.LOCAL, + }); + + + const response2 = await unsubscribe({ + signer: signer, + channelAddress: `eip155:5:${channelAddress}`, // channel address in CAIP + userAddress: `eip155:5:${signer.address}`, // user address in CAIP + onSuccess: () => { + console.log('opt out success'); + }, + onError: () => { + console.error('opt out error'); + }, + env: ENV.LOCAL, + }); + + + const apiResponse2 = await sendNotification({ + signer: signerChannel, // Needs to resolve to channel address + type: 3, // broadcast + identityType: 2, // direct payload + notification: { + title: `notification TITLE:`, + body: `notification BODY`, + }, + payload: { + title: `payload title`, + body: `sample msg body`, + cta: '', + img: '', + }, + recipients: `eip155:5:${signer.address}`, + channel: `eip155:5:${channelAddress}`, // your channel address + env: ENV.LOCAL, + }); + + + + //const w2wRejectRequest = await user2.chat.group.join(createdGroup.chatId); + //const updatedGroup2 = await user2.chat.group.leave(createdGroup.chatId); + + /*const updatedGroup3 = await user.chat.group.add(createdGroup.chatId, { + role: 'ADMIN', + accounts: [signer2.address], + }); + + + + const w2wAcceptsRequest = await user2.chat.group.join(createdGroup.chatId); + + /* const updatedGroup4 = await user.chat.group.add( + createdGroup.chatId, + { + role: 'ADMIN', + accounts: [signer3.address], + } + );*/ + + /*const w2wMessageResponse = await user2.chat.send(signer.address, { + content: MESSAGE, + }); + const w2wAcceptsRequest = await user.chat.accept(signer2.address); + + const w2wMessageResponse2 = await user2.chat.send(signer.address, { + content: MESSAGE, + }); + + //const w2wRejectRequest = await user2.chat.group.join(createdGroup.chatId); + + /* + + + const updatedGroup2 = await user2.chat.group.leave(createdGroup.chatId); + + + + const updatedGroup = await user.chat.group.update(createdGroup.chatId, { + description: 'Updated Description', + }); + + const groupMessageResponse = await user.chat.send(createdGroup.chatId, { + content: 'Hello', + type: MessageType.TEXT, + }); + + + + const w2wMessageResponse2 = await user2.chat.send(signer.address, { + content: MESSAGE, + }); + + const w2wMessageResponse2 = await user3.chat.send(signer.address, { + content: MESSAGE, + }); + const w2wRejectRequest = await user.chat.reject(signer3.address);*/ + + let timeoutTriggered = false; + + const timeout = new Promise((_, reject) => { + setTimeout(() => { + timeoutTriggered = true; + reject(new Error('Timeout after 5 seconds')); + }, 5000); + }); + + // Wrap the Promise.allSettled inside a Promise.race with the timeout + try { + const result = await Promise.race([ + Promise.allSettled([ + onDataReceived, + onMessageReceived, + onNoitificationsReceived, + ]), + timeout, + ]); + + if (timeoutTriggered) { + console.error('Timeout reached before events were emitted.'); + } else { + (result as PromiseSettledResult<any>[]).forEach((outcome) => { + if (outcome.status === 'fulfilled') { + //console.log(outcome.value); + } else if (outcome.status === 'rejected') { + console.error(outcome.reason); + } + }); + } + } catch (error) { + console.error(error); + } + }); +}); diff --git a/packages/restapi/yarn.lock b/packages/restapi/yarn.lock index de55ed8e8..1a2318580 100644 --- a/packages/restapi/yarn.lock +++ b/packages/restapi/yarn.lock @@ -397,12 +397,12 @@ "@hapi/hoek@^9.0.0": version "9.3.0" - resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" + resolved "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz" integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== "@hapi/topo@^5.0.0": version "5.1.0" - resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" + resolved "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz" integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== dependencies: "@hapi/hoek" "^9.0.0" @@ -425,10 +425,10 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@livepeer/core@^1.8.0": - version "1.8.0" - resolved "https://registry.npmjs.org/@livepeer/core/-/core-1.8.0.tgz" - integrity sha512-Sr+DplfGfhpv2Arh53tTTL9DyPEzlVAzy+eXd8+PMIlXLVOHTgGfDgpfpaeSCB8v8WlJtrgX50vFdSWyUyxi3g== +"@livepeer/core@^1.8.6": + version "1.8.6" + resolved "https://registry.npmjs.org/@livepeer/core/-/core-1.8.6.tgz" + integrity sha512-VWMHaHMzNCr8YuC9hD87Ju+fwnpldEoe3y9CqOXrQPyyIgiAWfraZBA6Ard67f09X9UBGaaRcAMgMcCUs9HtKA== dependencies: cross-fetch "^4.0.0" ms "^3.0.0-canary.1" @@ -470,6 +470,14 @@ resolved "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz" integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== +"@pushprotocol/socket@^0.5.2": + version "0.5.2" + resolved "https://registry.npmjs.org/@pushprotocol/socket/-/socket-0.5.2.tgz" + integrity sha512-lVGMT3q8T5by6qwAhQ+zIeE/yv7oUC9eIlFux8M7WaKu/ArLBrrojD5REbr9QXXwpJIP3Q8GJUKyClZl4uGsJw== + dependencies: + socket.io-client "^4.5.2" + tslib "^2.3.0" + "@scure/base@~1.1.0": version "1.1.1" resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz" @@ -494,21 +502,26 @@ "@sideway/address@^4.1.3": version "4.1.4" - resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0" + resolved "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz" integrity sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw== dependencies: "@hapi/hoek" "^9.0.0" "@sideway/formula@^3.0.1": version "3.0.1" - resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" + resolved "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz" integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== "@sideway/pinpoint@^2.0.0": version "2.0.0" - resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" + resolved "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== +"@socket.io/component-emitter@~3.1.0": + version "3.1.0" + resolved "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz" + integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg== + "@stitches/core@^1.2.8": version "1.2.8" resolved "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz" @@ -642,23 +655,24 @@ array-buffer-byte-length@^1.0.0: is-array-buffer "^3.0.1" array.prototype.every@^1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.4.tgz" - integrity sha512-Aui35iRZk1HHLRAyF7QP0KAnOnduaQ6fo6k1NVWfRc0xTs2AZ70ytlXvOmkC6Di4JmUs2Wv3DYzGtCQFSk5uGg== + version "1.1.5" + resolved "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.5.tgz" + integrity sha512-FfMQJ+/joFGXpRCltbzV3znaP5QxIhLFySo0fEPn3GuoYlud9LhknMCIxdYKC2qsM/6VHoSp6YGwe3EZXrEcwQ== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" is-string "^1.0.7" -arraybuffer.prototype.slice@^1.0.1: - version "1.0.1" - resolved "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.1.tgz" - integrity sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw== +arraybuffer.prototype.slice@^1.0.2: + version "1.0.2" + resolved "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz" + integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== dependencies: array-buffer-byte-length "^1.0.0" call-bind "^1.0.2" define-properties "^1.2.0" + es-abstract "^1.22.1" get-intrinsic "^1.2.1" is-array-buffer "^3.0.2" is-shared-array-buffer "^1.0.2" @@ -915,9 +929,9 @@ concat-map@0.0.1: integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== core-js@^3.31.1: - version "3.32.0" - resolved "https://registry.npmjs.org/core-js/-/core-js-3.32.0.tgz" - integrity sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww== + version "3.32.2" + resolved "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz" + integrity sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ== core-util-is@~1.0.0: version "1.0.3" @@ -957,7 +971,7 @@ custom-error-instance@2.1.1: resolved "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz" integrity sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg== -debug@4.3.4, debug@^4.3.2: +debug@4.3.4, debug@^4.3.2, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1005,11 +1019,21 @@ deep-equal@^2.2.2: which-collection "^1.0.1" which-typed-array "^1.1.9" +define-data-property@^1.0.1: + version "1.1.0" + resolved "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.0.tgz" + integrity sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: - version "1.2.0" - resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz" - integrity sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA== + version "1.2.1" + resolved "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== dependencies: + define-data-property "^1.0.1" has-property-descriptors "^1.0.0" object-keys "^1.1.1" @@ -1065,23 +1089,39 @@ end-of-stream@^1.1.0: dependencies: once "^1.4.0" +engine.io-client@~6.5.2: + version "6.5.2" + resolved "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.2.tgz" + integrity sha512-CQZqbrpEYnrpGqC07a9dJDz4gePZUgTPMU3NKJPSeQOyw27Tst4Pl3FemKoFGAlHzgZmKjoRmiJvbWfhCXUlIg== + dependencies: + "@socket.io/component-emitter" "~3.1.0" + debug "~4.3.1" + engine.io-parser "~5.2.1" + ws "~8.11.0" + xmlhttprequest-ssl "~2.0.0" + +engine.io-parser@~5.2.1: + version "5.2.1" + resolved "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.1.tgz" + integrity sha512-9JktcM3u18nU9N2Lz3bWeBgxVgOKpw7yhRaoxQA3FUDZzzw+9WlA6p4G4u0RixNkg14fH7EfEc/RhpurtiROTQ== + err-code@^3.0.1: version "3.0.1" resolved "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz" integrity sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA== -es-abstract@^1.19.0, es-abstract@^1.20.4: - version "1.22.1" - resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.1.tgz" - integrity sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw== +es-abstract@^1.22.1: + version "1.22.2" + resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz" + integrity sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA== dependencies: array-buffer-byte-length "^1.0.0" - arraybuffer.prototype.slice "^1.0.1" + arraybuffer.prototype.slice "^1.0.2" available-typed-arrays "^1.0.5" call-bind "^1.0.2" es-set-tostringtag "^2.0.1" es-to-primitive "^1.2.1" - function.prototype.name "^1.1.5" + function.prototype.name "^1.1.6" get-intrinsic "^1.2.1" get-symbol-description "^1.0.0" globalthis "^1.0.3" @@ -1097,23 +1137,23 @@ es-abstract@^1.19.0, es-abstract@^1.20.4: is-regex "^1.1.4" is-shared-array-buffer "^1.0.2" is-string "^1.0.7" - is-typed-array "^1.1.10" + is-typed-array "^1.1.12" is-weakref "^1.0.2" object-inspect "^1.12.3" object-keys "^1.1.1" object.assign "^4.1.4" - regexp.prototype.flags "^1.5.0" - safe-array-concat "^1.0.0" + regexp.prototype.flags "^1.5.1" + safe-array-concat "^1.0.1" safe-regex-test "^1.0.0" - string.prototype.trim "^1.2.7" - string.prototype.trimend "^1.0.6" - string.prototype.trimstart "^1.0.6" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" typed-array-buffer "^1.0.0" typed-array-byte-length "^1.0.0" typed-array-byte-offset "^1.0.0" typed-array-length "^1.0.4" unbox-primitive "^1.0.2" - which-typed-array "^1.1.10" + which-typed-array "^1.1.11" es-get-iterator@^1.1.3: version "1.1.3" @@ -1232,7 +1272,7 @@ execa@^1.0.0: figures@^1.4.0: version "1.7.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + resolved "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz" integrity sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ== dependencies: escape-string-regexp "^1.0.5" @@ -1267,7 +1307,7 @@ flat@^5.0.2: for-each@^0.3.3: version "0.3.3" - resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + resolved "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz" integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== dependencies: is-callable "^1.1.3" @@ -1284,22 +1324,22 @@ fsevents@~2.3.2: function-bind@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== -function.prototype.name@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" - integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== +function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.0" - functions-have-names "^1.2.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" -functions-have-names@^1.2.2, functions-have-names@^1.2.3: +functions-have-names@^1.2.3: version "1.2.3" - resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + resolved "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz" integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== get-browser-rtc@^1.1.0: @@ -1324,7 +1364,7 @@ get-func-name@^2.0.0: get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" + resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz" integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== dependencies: function-bind "^1.1.1" @@ -1334,7 +1374,7 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@ get-package-type@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== get-stream@^4.0.0: @@ -1346,7 +1386,7 @@ get-stream@^4.0.0: get-symbol-description@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + resolved "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz" integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== dependencies: call-bind "^1.0.2" @@ -1373,7 +1413,7 @@ glob@7.2.0: glob@^7.2.3: version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" @@ -1385,38 +1425,38 @@ glob@^7.2.3: globalthis@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + resolved "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz" integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== dependencies: define-properties "^1.1.3" gopd@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + resolved "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz" integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== dependencies: get-intrinsic "^1.1.3" graceful-fs@^4.2.4: version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== has-ansi@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + resolved "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz" integrity sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg== dependencies: ansi-regex "^2.0.0" has-bigints@^1.0.1, has-bigints@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz" integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== has-dynamic-import@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz#9bca87846aa264f2ad224fcd014946f5e5182f52" + resolved "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz" integrity sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ== dependencies: call-bind "^1.0.2" @@ -1434,38 +1474,38 @@ has-flag@^4.0.0: has-property-descriptors@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + resolved "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz" integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== dependencies: get-intrinsic "^1.1.1" has-proto@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + resolved "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz" integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== has-symbols@^1.0.2, has-symbols@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== has-tostringtag@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + resolved "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz" integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== dependencies: has-symbols "^1.0.2" has@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + resolved "https://registry.npmjs.org/has/-/has-1.0.3.tgz" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== dependencies: inherits "^2.0.3" @@ -1477,13 +1517,13 @@ he@1.2.0: integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== hls.js@^1.4.9: - version "1.4.10" - resolved "https://registry.yarnpkg.com/hls.js/-/hls.js-1.4.10.tgz#3feac40f21a558453b243b5b926b7317e70624e1" - integrity sha512-wAVSj4Fm2MqOHy5+BlYnlKxXvJlv5IuZHjlzHu18QmjRzSDFQiUDWdHs5+NsFMQrgKEBwuWDcyvaMC9dUzJ5Uw== + version "1.4.12" + resolved "https://registry.npmjs.org/hls.js/-/hls.js-1.4.12.tgz" + integrity sha512-1RBpx2VihibzE3WE9kGoVCtrhhDWTzydzElk/kyRbEOLnb1WIE+3ZabM/L8BqKFTCL3pUy4QzhXgD1Q6Igr1JA== hmac-drbg@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + resolved "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz" integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== dependencies: hash.js "^1.0.3" @@ -1515,7 +1555,7 @@ inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, internal-slot@^1.0.4, internal-slot@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.5.tgz#f2a2ee21f668f8627a4667f309dc0f4fb6674986" + resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz" integrity sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ== dependencies: get-intrinsic "^1.2.0" @@ -1529,7 +1569,7 @@ invert-kv@^2.0.0: is-arguments@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" + resolved "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz" integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== dependencies: call-bind "^1.0.2" @@ -1537,7 +1577,7 @@ is-arguments@^1.1.1: is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" + resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz" integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== dependencies: call-bind "^1.0.2" @@ -1546,7 +1586,7 @@ is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: is-bigint@^1.0.1: version "1.0.4" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz" integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== dependencies: has-bigints "^1.0.1" @@ -1560,7 +1600,7 @@ is-binary-path@~2.1.0: is-boolean-object@^1.1.0: version "1.1.2" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + resolved "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz" integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== dependencies: call-bind "^1.0.2" @@ -1568,19 +1608,19 @@ is-boolean-object@^1.1.0: is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: version "1.2.7" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== is-core-module@^2.9.0: - version "2.12.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" - integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== + version "2.13.0" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz" + integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ== dependencies: has "^1.0.3" is-date-object@^1.0.1, is-date-object@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" + resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz" integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== dependencies: has-tostringtag "^1.0.0" @@ -1592,7 +1632,7 @@ is-extglob@^2.1.1: is-finite@^1.0.1: version "1.1.0" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.1.0.tgz#904135c77fb42c0641d6aa1bcdbc4daa8da082f3" + resolved "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz" integrity sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w== is-fullwidth-code-point@^1.0.0: @@ -1626,17 +1666,17 @@ is-hex-prefixed@1.0.0: is-map@^2.0.1, is-map@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" + resolved "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz" integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== is-negative-zero@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz" integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== is-number-object@^1.0.4: version "1.0.7" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" + resolved "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz" integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== dependencies: has-tostringtag "^1.0.0" @@ -1653,7 +1693,7 @@ is-plain-obj@^2.1.0: is-regex@^1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz" integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== dependencies: call-bind "^1.0.2" @@ -1661,12 +1701,12 @@ is-regex@^1.1.4: is-set@^2.0.1, is-set@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" + resolved "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz" integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== is-shared-array-buffer@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz" integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== dependencies: call-bind "^1.0.2" @@ -1678,26 +1718,26 @@ is-stream@^1.1.0: is-stream@^2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + resolved "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz" integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== dependencies: has-tostringtag "^1.0.0" is-symbol@^1.0.2, is-symbol@^1.0.3: version "1.0.4" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + resolved "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz" integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== dependencies: has-symbols "^1.0.2" -is-typed-array@^1.1.10, is-typed-array@^1.1.9: +is-typed-array@^1.1.10, is-typed-array@^1.1.12, is-typed-array@^1.1.9: version "1.1.12" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + resolved "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.12.tgz" integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== dependencies: which-typed-array "^1.1.11" @@ -1709,19 +1749,19 @@ is-unicode-supported@^0.1.0: is-weakmap@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" + resolved "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz" integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== is-weakref@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz" integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== dependencies: call-bind "^1.0.2" is-weakset@^2.0.1: version "2.0.2" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.2.tgz#4569d67a747a1ce5a994dfd4ef6dcea76e7c0a1d" + resolved "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz" integrity sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg== dependencies: call-bind "^1.0.2" @@ -1729,12 +1769,12 @@ is-weakset@^2.0.1: isarray@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + resolved "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz" integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== isarray@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== isexe@^2.0.0: @@ -1743,9 +1783,9 @@ isexe@^2.0.0: integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== joi@^17.9.2: - version "17.9.2" - resolved "https://registry.yarnpkg.com/joi/-/joi-17.9.2.tgz#8b2e4724188369f55451aebd1d0b1d9482470690" - integrity sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw== + version "17.10.2" + resolved "https://registry.npmjs.org/joi/-/joi-17.10.2.tgz" + integrity sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA== dependencies: "@hapi/hoek" "^9.0.0" "@hapi/topo" "^5.0.0" @@ -1755,7 +1795,7 @@ joi@^17.9.2: js-base64@^3.7.2: version "3.7.5" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.5.tgz#21e24cf6b886f76d6f5f165bfcd69cc55b9e3fca" + resolved "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz" integrity sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA== js-sha3@0.8.0: @@ -1778,11 +1818,11 @@ lcid@^2.0.0: invert-kv "^2.0.0" livepeer@^2.5.8: - version "2.8.0" - resolved "https://registry.npmjs.org/livepeer/-/livepeer-2.8.0.tgz" - integrity sha512-ZYw/bew356VZ1MZE6T7NBV6xgQ6yukqutb/GiSk9Yz+vjJvxy2npu4sEhgZ1pkHFVVczcGVwjZidWWaZ+oMwGg== + version "2.8.6" + resolved "https://registry.npmjs.org/livepeer/-/livepeer-2.8.6.tgz" + integrity sha512-8K2lRtpgZKbv6l6cGYYMJW9qpdRKkGUuy7R7xTLkS6NaRQzaeW08vubftmbMHil8v8GX/nDmodcW2vA4oIkP0w== dependencies: - "@livepeer/core" "^1.8.0" + "@livepeer/core" "^1.8.6" "@stitches/core" "^1.2.8" core-js "^3.31.1" cross-fetch "^4.0.0" @@ -1999,9 +2039,9 @@ nice-try@^1.0.4: integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-fetch@^2.6.12: - version "2.6.12" - resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz" - integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g== + version "2.7.0" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" @@ -2271,14 +2311,14 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" -regexp.prototype.flags@^1.5.0: - version "1.5.0" - resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz" - integrity sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA== +regexp.prototype.flags@^1.5.0, regexp.prototype.flags@^1.5.1: + version "1.5.1" + resolved "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz" + integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== dependencies: call-bind "^1.0.2" define-properties "^1.2.0" - functions-have-names "^1.2.3" + set-function-name "^2.0.0" repeat-string@^1.5.2: version "1.6.1" @@ -2314,13 +2354,13 @@ retry@^0.12.0: resolved "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz" integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== -safe-array-concat@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz" - integrity sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ== +safe-array-concat@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz" + integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== dependencies: call-bind "^1.0.2" - get-intrinsic "^1.2.0" + get-intrinsic "^1.2.1" has-symbols "^1.0.3" isarray "^2.0.5" @@ -2370,6 +2410,15 @@ set-blocking@^2.0.0: resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== +set-function-name@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.1.tgz" + integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== + dependencies: + define-data-property "^1.0.1" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.0" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz" @@ -2409,6 +2458,24 @@ simple-peer@^9.11.1: randombytes "^2.1.0" readable-stream "^3.6.0" +socket.io-client@^4.5.2: + version "4.7.2" + resolved "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.2.tgz" + integrity sha512-vtA0uD4ibrYD793SOIAwlo8cj6haOeMHrGvwPxJsxH7CeIksqJ+3Zc06RvWTIFgiSqx4A3sOnTXpfAEE2Zyz6w== + dependencies: + "@socket.io/component-emitter" "~3.1.0" + debug "~4.3.2" + engine.io-client "~6.5.2" + socket.io-parser "~4.2.4" + +socket.io-parser@~4.2.4: + version "4.2.4" + resolved "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz" + integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew== + dependencies: + "@socket.io/component-emitter" "~3.1.0" + debug "~4.3.1" + split@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/split/-/split-1.0.0.tgz" @@ -2449,32 +2516,32 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string.prototype.trim@^1.2.7: - version "1.2.7" - resolved "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz" - integrity sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg== +string.prototype.trim@^1.2.7, string.prototype.trim@^1.2.8: + version "1.2.8" + resolved "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz" + integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" -string.prototype.trimend@^1.0.6: - version "1.0.6" - resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz" - integrity sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ== +string.prototype.trimend@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz" + integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" -string.prototype.trimstart@^1.0.6: - version "1.0.6" - resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz" - integrity sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA== +string.prototype.trimstart@^1.0.7: + version "1.0.7" + resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== dependencies: call-bind "^1.0.2" - define-properties "^1.1.4" - es-abstract "^1.20.4" + define-properties "^1.2.0" + es-abstract "^1.22.1" string_decoder@^1.1.1: version "1.3.0" @@ -2666,6 +2733,11 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" +tslib@^2.3.0: + version "2.6.2" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + tus-js-client@^3.1.0: version "3.1.1" resolved "https://registry.npmjs.org/tus-js-client/-/tus-js-client-3.1.1.tgz" @@ -2815,7 +2887,7 @@ which-module@^2.0.0: resolved "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz" integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== -which-typed-array@^1.1.10, which-typed-array@^1.1.11, which-typed-array@^1.1.9: +which-typed-array@^1.1.11, which-typed-array@^1.1.9: version "1.1.11" resolved "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz" integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew== @@ -2865,6 +2937,16 @@ ws@7.4.6: resolved "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@~8.11.0: + version "8.11.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz" + integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== + +xmlhttprequest-ssl@~2.0.0: + version "2.0.0" + resolved "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz" + integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A== + xtend@~4.0.1: version "4.0.2" resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz" diff --git a/packages/uiweb/CHANGELOG.md b/packages/uiweb/CHANGELOG.md index 4589c675c..fc461f033 100644 --- a/packages/uiweb/CHANGELOG.md +++ b/packages/uiweb/CHANGELOG.md @@ -2,11 +2,279 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). -## [1.1.10](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.9...uiweb-1.1.10) (2023-08-10) +## [0.0.1-alpha.15](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.14...uiweb-0.0.1-alpha.15) (2023-09-25) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([eef6b18](https://github.com/ethereum-push-notification-service/push-sdk/commit/eef6b18d87a27c59930029b9933540333fb36bc6)) + + + +## [0.0.1-alpha.14](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.13...uiweb-0.0.1-alpha.14) (2023-09-25) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([7efc3ab](https://github.com/ethereum-push-notification-service/push-sdk/commit/7efc3ab1c3a409a29166c9644c94708b0ac37417)) + + + +## [0.0.1-alpha.13](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.12...uiweb-0.0.1-alpha.13) (2023-09-21) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([fed5d89](https://github.com/ethereum-push-notification-service/push-sdk/commit/fed5d8940aaa20f6f68f6ec3dad6d4dd90afdda0)) + + + +## [0.0.1-alpha.12](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.11...uiweb-0.0.1-alpha.12) (2023-09-20) + + +### Bug Fixes + +* added condition while showing tokengatedIcon ([#715](https://github.com/ethereum-push-notification-service/push-sdk/issues/715)) ([8ae0f49](https://github.com/ethereum-push-notification-service/push-sdk/commit/8ae0f49fcd385dfdcad197de2f89c58a074f681e)) +* added disconnect for wallet ([#721](https://github.com/ethereum-push-notification-service/push-sdk/issues/721)) ([4e30c36](https://github.com/ethereum-push-notification-service/push-sdk/commit/4e30c36532a55abd440f779c98b31f52bfb9e107)) +* Merge branch 'alpha' into alpha-deployment ([a3b4ead](https://github.com/ethereum-push-notification-service/push-sdk/commit/a3b4ead84601329e36afd8555011a5088dba6983)) +* Merge branch 'alpha' into alpha-deployment ([a356f4b](https://github.com/ethereum-push-notification-service/push-sdk/commit/a356f4b8497252e75c8f70fd6f6bf533a6980c0a)) +* Merge branch 'alpha' into alpha-deployment ([1a4c5ac](https://github.com/ethereum-push-notification-service/push-sdk/commit/1a4c5ac8f704cc5bfeed1ba4eb688e4742acfd9e)) + + + +## [0.0.1-alpha.11](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.10...uiweb-0.0.1-alpha.11) (2023-09-15) + + + +## [0.0.1-alpha.10](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.9...uiweb-0.0.1-alpha.10) (2023-09-09) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([f410046](https://github.com/ethereum-push-notification-service/push-sdk/commit/f410046d871bb34f3ec7a7eecd9f500d50fc0fbf)) + + + +## [0.0.1-alpha.9](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.8...uiweb-0.0.1-alpha.9) (2023-09-08) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([699706b](https://github.com/ethereum-push-notification-service/push-sdk/commit/699706bc0c2b05eebb11624f7b16411d4111a5cb)) +* merge main ([5f37942](https://github.com/ethereum-push-notification-service/push-sdk/commit/5f379427e8a517089758de776eab9f2409aa61f8)) + + + +## [1.1.13](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.2...uiweb-1.1.13) (2023-08-24) + + +### Bug Fixes + +* dummy change ([cbfbec0](https://github.com/ethereum-push-notification-service/push-sdk/commit/cbfbec0b17a460361b4b5ecef84aaa45b06ab7a2)) + + + +## [1.1.12](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.11...uiweb-1.1.12) (2023-08-23) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([64278ec](https://github.com/ethereum-push-notification-service/push-sdk/commit/64278eccd6fd51d02b123ec00e1d36fa94a23608)) + + + +## [1.1.11](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.10...uiweb-1.1.11) (2023-08-18) + + +### Bug Fixes + +* merge main ([f53a5e2](https://github.com/ethereum-push-notification-service/push-sdk/commit/f53a5e279e3780566b4e2a9242b3555ef50fb4a6)) + + + +## [1.1.10](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.1...uiweb-1.1.10) (2023-08-10) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([e504703](https://github.com/ethereum-push-notification-service/push-sdk/commit/e5047039c6ec668c0a2ad5950d7a5ba227c4f50a)) + + + +## [1.1.9](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.0...uiweb-1.1.9) (2023-08-10) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([843cd01](https://github.com/ethereum-push-notification-service/push-sdk/commit/843cd0169a270bbab69922021edf312616de3802)) + + + +## [1.1.8](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.7...uiweb-1.1.8) (2023-08-04) + + +### Bug Fixes + +* merge main ([b9e4440](https://github.com/ethereum-push-notification-service/push-sdk/commit/b9e44408fa4c97720b12217486e8d13ef3caeb00)) + + + +## [1.1.7](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.6...uiweb-1.1.7) (2023-07-31) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([9755baf](https://github.com/ethereum-push-notification-service/push-sdk/commit/9755baf3d4bcd3ab3fd365fad9d8fb7623fda58f)) + + + +## [1.1.6](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.5...uiweb-1.1.6) (2023-07-28) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([e33017a](https://github.com/ethereum-push-notification-service/push-sdk/commit/e33017afb2d4e9361d5df47e0f7e726ecdffbc32)) + + + +## [1.1.5](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.4...uiweb-1.1.5) (2023-07-27) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([90f51b9](https://github.com/ethereum-push-notification-service/push-sdk/commit/90f51b9009096ae8fcb1599d6fa8fe5cb74bbd5a)) +* merge main ([1bdc675](https://github.com/ethereum-push-notification-service/push-sdk/commit/1bdc6754bc67b489ca9e14597aa6c5d6197580e7)) + + + +## [1.1.4](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.3...uiweb-1.1.4) (2023-07-20) + + +### Bug Fixes + +* merge main ([24784e9](https://github.com/ethereum-push-notification-service/push-sdk/commit/24784e9ceca8f3757481f3be72efd0ca1ff3fba8)) + + + +## [1.1.3](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.2...uiweb-1.1.3) (2023-07-20) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([9f77f39](https://github.com/ethereum-push-notification-service/push-sdk/commit/9f77f391b26111006891c10a3cc8eab06e26f14f)) + + + +## [1.1.2](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.1...uiweb-1.1.2) (2023-07-18) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([8bc14a7](https://github.com/ethereum-push-notification-service/push-sdk/commit/8bc14a711f308fada706fb8fc228136e4ea24544)) + + + +## [1.1.1](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.0...uiweb-1.1.1) (2023-07-17) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([2e2c904](https://github.com/ethereum-push-notification-service/push-sdk/commit/2e2c904040260726d5c5087aed6e33d0d722a0f4)) + + + +# [1.1.0](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.0.2...uiweb-1.1.0) (2023-07-14) + + +### Bug Fixes + +* Merge branch 'main' into deployment ([fc7a9dc](https://github.com/ethereum-push-notification-service/push-sdk/commit/fc7a9dc64b4bcfdaa96aed70344b0ce95a1e0a6f)) +* Merge branch 'main' into deployment ([89b72a7](https://github.com/ethereum-push-notification-service/push-sdk/commit/89b72a7898af285c35fa03c6fb73708112f5d94c)) +* Merge branch 'main' into deployment ([1d52d6b](https://github.com/ethereum-push-notification-service/push-sdk/commit/1d52d6ba5aaadd70d7ccfd3904100586ad74d0f0)) +* merge main ([b58d9d5](https://github.com/ethereum-push-notification-service/push-sdk/commit/b58d9d53bd91fa33200a854170fe7e3facff4371)) + + + +## [1.0.2](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.0.1...uiweb-1.0.2) (2023-05-13) + + +### Bug Fixes + +* merge main ([26377c3](https://github.com/ethereum-push-notification-service/push-sdk/commit/26377c322ad01737e40244f6a815308c3c003aca)) +* socket lib update ([1301f99](https://github.com/ethereum-push-notification-service/push-sdk/commit/1301f999fe37b8e801a3d3e24aa45cf012db158a)) +* update package json ([6c321c7](https://github.com/ethereum-push-notification-service/push-sdk/commit/6c321c760055fa9aaebf1ee5f693bbbad16fb9c8)) +* updated socket version ([5052b6a](https://github.com/ethereum-push-notification-service/push-sdk/commit/5052b6ab721a942dcb7560bfe875296fa2d6a992)) + + + +## [0.0.1-alpha.8](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.7...uiweb-0.0.1-alpha.8) (2023-08-29) + + +### Bug Fixes + +* fixed msg bubble width ([#691](https://github.com/ethereum-push-notification-service/push-sdk/issues/691)) ([c24a9e1](https://github.com/ethereum-push-notification-service/push-sdk/commit/c24a9e144110ad3c67decbc1364b5dd610f5f58a)) +* Merge branch 'alpha' into alpha-deployment ([a825667](https://github.com/ethereum-push-notification-service/push-sdk/commit/a825667be9380ec6e5b457f5751a8b6b6b5a6b23)) + + + +## [0.0.1-alpha.7](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.6...uiweb-0.0.1-alpha.7) (2023-08-26) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([45e6489](https://github.com/ethereum-push-notification-service/push-sdk/commit/45e6489eca403160d512f30fa6617c980e16a244)) + + + +## [0.0.1-alpha.6](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.5...uiweb-0.0.1-alpha.6) (2023-08-25) + + +### Bug Fixes + +* fixed ([#689](https://github.com/ethereum-push-notification-service/push-sdk/issues/689)) ([a7ed3c0](https://github.com/ethereum-push-notification-service/push-sdk/commit/a7ed3c0955316da00739f114afe1a3d3a958c66e)) +* Merge branch 'alpha' into alpha-deployment ([af5a4a7](https://github.com/ethereum-push-notification-service/push-sdk/commit/af5a4a75bde324ef8552fb8a3d404e8c57f59f1c)) + + + +## [0.0.1-alpha.5](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.4...uiweb-0.0.1-alpha.5) (2023-08-25) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([292a8f9](https://github.com/ethereum-push-notification-service/push-sdk/commit/292a8f94fbe1c13c49aa2b07c633e10cad1f02bc)) + + + +## [0.0.1-alpha.4](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.3...uiweb-0.0.1-alpha.4) (2023-08-25) + + +### Bug Fixes + +* Merge branch 'alpha' into alpha-deployment ([7a0d87e](https://github.com/ethereum-push-notification-service/push-sdk/commit/7a0d87eb35a77cad6898be54af5431eb5335c80d)) + + + +## [0.0.1-alpha.3](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.2...uiweb-0.0.1-alpha.3) (2023-08-25) + + + +## [0.0.1-alpha.2](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.1...uiweb-0.0.1-alpha.2) (2023-08-23) + + +### Bug Fixes + +* hide few spaces features ([#622](https://github.com/ethereum-push-notification-service/push-sdk/issues/622)) ([0e2556c](https://github.com/ethereum-push-notification-service/push-sdk/commit/0e2556c6bbe3438cd30851ffdd9764b027f42f6e)) +* merge alpha ([1783d45](https://github.com/ethereum-push-notification-service/push-sdk/commit/1783d45bb3ceab1cce3c6bb19dfbda38c3662a3e)) +* Merge branch 'alpha' into alpha-deployment ([8b50b53](https://github.com/ethereum-push-notification-service/push-sdk/commit/8b50b53eae51729ab9c5202b1750d70c444be829)) +* merge main ([f338fd4](https://github.com/ethereum-push-notification-service/push-sdk/commit/f338fd49707933c65bdcc7736cdd08d6784625ba)) +* **spaces:** broadcast changes and UX fixes ([#674](https://github.com/ethereum-push-notification-service/push-sdk/issues/674)) ([375ebe7](https://github.com/ethereum-push-notification-service/push-sdk/commit/375ebe7f7e757d84df62cd103884e75d04bcc2b0)), closes [#642](https://github.com/ethereum-push-notification-service/push-sdk/issues/642) [#657](https://github.com/ethereum-push-notification-service/push-sdk/issues/657) [#656](https://github.com/ethereum-push-notification-service/push-sdk/issues/656) + + + +## [0.0.1-alpha.1](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-0.0.1-alpha.0...uiweb-0.0.1-alpha.1) (2023-08-10) -## [1.1.9](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.1.8...uiweb-1.1.9) (2023-08-10) ## [0.0.1-alpha.0](https://github.com/ethereum-push-notification-service/push-sdk/compare/uiweb-1.0.1...uiweb-0.0.1-alpha.0) (2023-08-09) diff --git a/packages/uiweb/README.md b/packages/uiweb/README.md index d7bbe3e09..d5f2e96f0 100644 --- a/packages/uiweb/README.md +++ b/packages/uiweb/README.md @@ -149,7 +149,7 @@ where | cta | string | Call To Action Link (given during notification creation) | | image | string | Any media link (given during notification creation) | | url | string | Channel Link (given during channel setup) | -| chainName | string | Can be anyone of the following blockchain networks on which the notification was sent - "ETH_MAINNET", "ETH_TEST_GOERLI", "POLYGON_MAINNET", "POLYGON_TEST_MUMBAI", "BSC_MAINNET, "BSC_TESTNET", "OPTIMISM_MAINNET", "OPTIMISM_TESTNET", "POLYGON_ZK_EVM_TESTNET", "POLYGON_ZK_EVM_MAINNET", "THE_GRAPH" | +| chainName | string | Can be anyone of the following blockchain networks on which the notification was sent - "ETH_MAINNET", "ETH_TEST_GOERLI", "POLYGON_MAINNET", "POLYGON_TEST_MUMBAI", "BSC_MAINNET, "BSC_TESTNET", "OPTIMISM_MAINNET", "OPTIMISM_TESTNET", "POLYGON_ZK_EVM_TESTNET", "POLYGON_ZK_EVM_MAINNET", "ARBITRUM_TESTNET", "ARBITRUMONE_MAINNET", "THE_GRAPH" | | theme | string | 'light' or 'dark' (customization to be given by the dApp) | | customTheme | INotificationItemTheme | custom theme object for the component | | isSpam | boolean | whether a spam notification or not | @@ -330,3 +330,4 @@ Allowed Options (props with * are mandatory) | activeChat | string | - | to open a particular chat when modal first opens | | onClose | () => void | - | function to execute when modal is minimised | | env | string | 'prod' | API env - 'prod', 'staging', 'dev'| + diff --git a/packages/uiweb/package.json b/packages/uiweb/package.json index 7e3eea05b..6645e2d69 100644 --- a/packages/uiweb/package.json +++ b/packages/uiweb/package.json @@ -1,23 +1,33 @@ { "name": "@pushprotocol/uiweb", - "version": "0.0.1-alpha.0", + "version": "0.0.1-alpha.15", "publishConfig": { "registry": "https://registry.npmjs.org/" }, "dependencies": { + "@livekit/components-react": "^1.2.2", + "@livekit/components-styles": "^1.0.6", "@livepeer/react": "^2.6.0", "@pushprotocol/socket": "^0.5.0", "@unstoppabledomains/resolution": "^8.5.0", + "@web3-onboard/coinbase": "^2.2.5", + "@web3-onboard/core": "^2.21.1", + "@web3-onboard/injected-wallets": "^2.10.5", + "@web3-onboard/react": "^2.8.9", + "@web3-onboard/walletconnect": "^2.4.6", "@web3-react/injected-connector": "^6.0.7", "date-fns": "^2.28.0", "emoji-picker-react": "^4.4.9", + "ethers": "^5.6.8", "font-awesome": "^4.7.0", "gif-picker-react": "^1.1.0", "html-react-parser": "^1.4.13", + "livekit-client": "^1.13.3", "moment": "^2.29.4", "react-icons": "^4.10.1", "react-toastify": "^9.1.3", - "react-twitter-embed": "^4.0.4" + "react-twitter-embed": "^4.0.4", + "uuid": "^9.0.1" }, "peerDependencies": { "@pushprotocol/restapi": "^1.2.15", diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx index 0ba4639b9..dd8d4f64d 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/AddWalletContent.tsx @@ -1,335 +1,215 @@ -import { useContext, useEffect, useState } from "react"; -import styled from "styled-components"; -import { ThemeContext } from "../theme/ThemeProvider"; -import { useChatData } from "../../../hooks"; -import { displayDefaultUser, getAddress, walletToPCAIP10 } from "../../../helpers"; -import { IToast, ModalButtonProps, User } from "../exportedTypes"; -import * as PushAPI from '@pushprotocol/restapi'; -import { ethers } from "ethers"; -import { addWalletValidation } from "../helpers/helper"; -import ArrowGreyIcon from '../../../icons/CaretDownGrey.svg' -import ArrowLeftIcon from '../../../icons/ArrowLeft.svg'; -import CloseIcon from '../../../icons/close.svg'; -import { Spinner } from "../../supportChat/spinner/Spinner"; -import { MoreLightIcon } from '../../../icons/MoreLight'; +import { useContext, useState } from 'react'; + +import styled from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { useChatData } from '../../../hooks'; +import { MdError } from 'react-icons/md'; + +import { Spinner } from '../../supportChat/spinner/Spinner'; import { MoreDarkIcon } from '../../../icons/MoreDark'; -import { SearchIcon } from '../../../icons/SearchIcon'; -import { Section, Span, Image } from "../../reusables/sharedStyling"; +import { Section, Span, Image } from '../../reusables/sharedStyling'; import { AddUserDarkIcon } from '../../../icons/Adddark'; -import { device } from "../../../config"; -import { MemberListContainer } from "./MemberListContainer"; -import useMediaQuery from "../helpers/useMediaQuery"; -import useToast from "../helpers/NewToast"; -import { MdCheckCircle, MdError } from "react-icons/md"; -import { Modal } from "../helpers/Modal"; - - - -export const AddWalletContent = ({ onSubmit, handlePrevious, onClose, memberList, handleMemberList, title, groupMembers, isLoading }: {onSubmit: ()=> void ,onClose: ()=> void, handlePrevious: ()=> void, memberList: any, handleMemberList: any, title: string, groupMembers: any, isLoading?: boolean }) => { - const theme = useContext(ThemeContext); - - const [searchedUser, setSearchedUser] = useState<string>(''); - const [filteredUserData, setFilteredUserData] = useState<any>(null); - const [isInValidAddress, setIsInvalidAddress] = useState<boolean>(false); - const [isLoadingSearch, setIsLoadingSearch] = useState<boolean>(false); - const { account, env } = useChatData(); - const isMobile = useMediaQuery(device.mobileL); - const groupInfoToast = useToast(); - - - useEffect(() => { - if (isInValidAddress) { - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: 'Invalid Address', - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - } - }, [isInValidAddress]); - - const onChangeSearchBox = (e: any) => { - setSearchedUser(e.target.value); - }; - - const handleUserSearch = async (userSearchData: string): Promise<void> => { - try{ - const caip10 = walletToPCAIP10(userSearchData); - let filteredData: User; - - if (userSearchData.length) { - filteredData = await PushAPI.user.get({ - account: caip10, - env: env - }); - - if (filteredData !== null) { - setFilteredUserData(filteredData); - } - // User is not in the protocol. Create new user - else { - if (ethers.utils.isAddress(userSearchData)) { - const displayUser = displayDefaultUser({ caip10 }); - setFilteredUserData(displayUser); - } else { - setIsInvalidAddress(true); - setFilteredUserData(null); - } - } - } else { - setFilteredUserData(null); - } - setIsLoadingSearch(false); - } - catch(error){ - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: 'Unsuccessful search, Try again', - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - } - }; - - const handleSearch = async (e: any): Promise<void> => { - setIsLoadingSearch(true); - setIsInvalidAddress(false); - e.preventDefault(); - if (!ethers.utils.isAddress(searchedUser)) { - let address: string; - try { - address = await getAddress(searchedUser, env) as string; - // if (!address) { - // address = await library.resolveName(searchedUser); - // } - // this ensures address are checksummed - address = ethers.utils.getAddress(address?.toLowerCase()); - if (address) { - handleUserSearch(address); - } else { - setIsInvalidAddress(true); - setFilteredUserData(null); - } - } catch (err) { - setIsInvalidAddress(true); - setFilteredUserData(null); - } finally { - setIsLoadingSearch(false); - } - } else { - handleUserSearch(searchedUser); - } - }; - - const clearInput = () => { - setSearchedUser(''); - setFilteredUserData(null); - setIsLoadingSearch(false); - }; +import { MemberListContainer } from './MemberListContainer'; +import useMediaQuery from '../../../hooks/useMediaQuery'; +import useToast from '../reusables/NewToast'; + +import { + getNewChatUser, +} from '../../../helpers'; +import { ModalButtonProps, User } from '../exportedTypes'; +import { addWalletValidation } from '../helpers/helper'; +import { device } from '../../../config'; +import CloseIcon from '../../../icons/close.svg'; +import { ChatSearchInput, CustomStyleParamsType, ModalHeader } from '../reusables'; +import useGetChatProfile from '../../../hooks/useGetChatProfile'; +import { BackIcon } from '../../../icons/Back'; + + +type AddWalletContentProps = { + onSubmit: () => void; + onClose: () => void; + handlePrevious: () => void; + memberList: any; + handleMemberList: any; + groupMembers: any; + isLoading?: boolean; + modalHeader: string; +}; +export const AddWalletContent = ({ + onSubmit, + handlePrevious, + onClose, + memberList, + handleMemberList, + groupMembers, + isLoading, + modalHeader, +}: AddWalletContentProps) => { + const theme = useContext(ThemeContext); + + const [filteredUserData, setFilteredUserData] = useState<any>(null); + const { account, env } = useChatData(); + const isMobile = useMediaQuery(device.mobileL); + const {fetchChatProfile} = useGetChatProfile(); + const groupInfoToast = useToast(); + const customSearchStyle:CustomStyleParamsType = { + background:theme.backgroundColor?.modalInputBackground, + border:theme.border?.modalInnerComponents, + placeholderColor:theme.textColor?.modalSubHeadingText, + fontSize:'15px', + fontWeight:'400' + }; + + const handleSearch = async ({searchedText}:{searchedText:string}): Promise<void> => { + //fix ens search + const newChatUser = await getNewChatUser({ + searchText: searchedText, + fetchChatProfile, + env, + }); + if(newChatUser){ + setFilteredUserData(newChatUser); + } + else{ + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: 'Invalid Address', + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + } + }; + + const clearInput = () => { + setFilteredUserData(null); + }; const addMemberToList = (member: User) => { let errorMessage = ''; - errorMessage = addWalletValidation(member, memberList, groupMembers, account); + errorMessage = addWalletValidation( + member, + memberList, + groupMembers, + account + ); if (errorMessage) { groupInfoToast.showMessageToast({ toastTitle: 'Error', toastMessage: errorMessage, toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), + getToastIcon: (size) => <MdError size={size} color="red" />, }); - } else { - handleMemberList((prev: any) => [...prev, { ...member, isAdmin: false }]); - } - - setFilteredUserData(''); - clearInput(); - }; - - const removeMemberFromList = (member: User) => { - const filteredMembers = memberList?.filter((user: any) => user.wallets !== member.wallets); - handleMemberList(filteredMembers); - }; - - return ( - <Section width={isMobile ? '100%' : '410px'} flexDirection='column' padding={isMobile ? '0px auto' :'0px 10px'}> - <Section flex='1' flexDirection='row' justifyContent='space-between'> - - <Image src={ArrowLeftIcon} height="24px" maxHeight="24px" width={'auto'} onClick={()=>handlePrevious()} cursor='pointer' /> - - <Span textAlign='center' fontSize='20px' color={theme.modalHeadingColor}>Add Wallets</Span> - - <Image src={CloseIcon} height="24px" maxHeight="24px" width={'auto'} onClick={()=>onClose()} cursor='pointer' /> - </Section> - - <Section margin='50px 0 10px 0' flex='1' flexDirection='row' justifyContent='space-between'> - <Span fontSize='18px' color={theme.modalIconColor}>Add Wallets</Span> - - <Span fontSize='14px' color={theme.modalPrimaryTextColor}> - {groupMembers - ? `0${memberList?.length + groupMembers?.length} / 09 Members` - : `0${memberList?.length} / 09 Members`} - </Span> - </Section> - - <Section flex='1'> - <SearchBarContent onSubmit={handleSearch}> - <Input - type="text" - value={searchedUser} - onChange={onChangeSearchBox} - placeholder="Search Web3 domain or 0x123..." - color={theme.modalPrimaryTextColor} - theme={theme} - /> - <Section - position="absolute" - alignItems="flex-end" - width="40px" - height="24px" - top="22px" - right="16px" - > - {searchedUser.length > 0 && ( - <Image src={CloseIcon} height="20px" maxHeight="20px" width={'auto'} onClick={()=>clearInput()} cursor='pointer' /> - )} - {searchedUser.length == 0 && !filteredUserData && - <div style={{ cursor: 'pointer' }}> - <SearchIcon /> - </div> - } - </Section> - </SearchBarContent> - </Section> - - {filteredUserData ? ( - <MemberList> - <MemberListContainer - memberData={filteredUserData} - handleMemberList={addMemberToList} - lightIcon={<AddUserDarkIcon />} - darkIcon={<AddUserDarkIcon />} - /> - </MemberList> - ) : isLoadingSearch ? ( - <Section margin="10px 0px 34px 0px"> - <Spinner size={'35'} color='#cf1c84' /> - </Section> - ) : null} - - <MultipleMemberList> - {memberList?.map((member: any, index: any) => ( - <MemberListContainer - key={index} - memberList={memberList} - memberData={member} - handleMembers={handleMemberList} - handleMemberList={removeMemberFromList} - lightIcon={<MoreLightIcon />} - darkIcon={<MoreDarkIcon />} - /> - ))} - </MultipleMemberList> - - <Section flex='1'> - <ModalConfirmButton - onClick={() => onSubmit()} - isLoading={isLoading} - memberListCount={memberList?.length > 0} - theme={theme} - > - {!isLoading && groupMembers ? 'Add To Group' : ''} - {isLoading && <Spinner size='30' color='#fff' /> } - </ ModalConfirmButton> - </Section> - - </Section> - ) -} - -const SearchBarContent = styled.form` - position: relative; - display: flex; - flex: 1; -`; + } else { + handleMemberList((prev: any) => [...prev, { ...member, isAdmin: false }]); + } + + setFilteredUserData(''); + clearInput(); + }; + + const removeMemberFromList = (member: User) => { + const filteredMembers = memberList?.filter( + (user: any) => user.wallets.toLowerCase() !== member.wallets.toLowerCase() + ); + handleMemberList(filteredMembers); + }; + + return ( + <Section + width={isMobile ? '100%' : '410px'} + flexDirection="column" + padding={isMobile ? '0px auto' : '0px 10px'} + > + <ModalHeader title='Add More Wallets' handleClose={onClose} handlePrevious={handlePrevious} /> + + <Section + margin="50px 0 10px 0" + flex="1" + flexDirection="row" + justifyContent="space-between" + > + <Span fontSize="18px" color={theme.textColor?.modalSubHeadingText}> + Add Wallets + </Span> + + <Span fontSize="14px" color={theme.textColor?.modalSubHeadingText}> + {groupMembers + ? `0${memberList?.length + groupMembers?.length} / 09 Members` + : `0${memberList?.length} / 09 Members`} + </Span> + </Section> + + <Section flex="1"> + <ChatSearchInput + handleSearch={handleSearch} + clearInput={clearInput} + placeholder="Search Web3 domain or 0x123..." + customStyle={customSearchStyle} + /> + </Section> + + {filteredUserData && ( + <MemberList> + <MemberListContainer + memberData={filteredUserData} + handleMemberList={addMemberToList} + darkIcon={<AddUserDarkIcon />} + /> + </MemberList> + ) } + + <MultipleMemberList> + {memberList?.map((member: any, index: any) => ( + <MemberListContainer + key={index} + memberList={memberList} + memberData={member} + handleMembers={handleMemberList} + handleMemberList={removeMemberFromList} + darkIcon={<MoreDarkIcon />} + /> + ))} + </MultipleMemberList> + + <Section flex="1" alignSelf="center"> + <ModalConfirmButton + onClick={() => onSubmit()} + isLoading={isLoading} + memberListCount={memberList?.length > 0} + theme={theme} + > + {!isLoading && groupMembers ? 'Add To Group' : ''} + {isLoading && <Spinner size="30" color="#fff" />} + </ModalConfirmButton> + </Section> + </Section> + ); +}; + + -const Input = styled.input` - box-sizing: border-box; - display: flex; - flex: 1; -// min-width: 445px; - height: 48px; - padding: 0px 50px 0px 16px; - margin: 10px 0px 0px; - border-radius: 99px; - border: 1px solid; - border-color: ${(props) => props.theme.modalSearchBarBorderColor}; - background: ${(props) => props.theme.modalSearchBarBackground}; - color: ${(props) => props.color || '#000'}; - &:focus { - outline: none; - background-image: linear-gradient( - ${(props) => props.theme.snapFocusBg}, - ${(props) => props.theme.snapFocusBg} - ), - linear-gradient( - to right, - rgba(182, 160, 245, 1), - rgba(244, 110, 246, 1), - rgba(255, 222, 211, 1), - rgba(255, 207, 197, 1) - ); - background-origin: border; - border: 1px solid transparent !important; - background-clip: padding-box, border-box; - } - &::placeholder { - color: #657795; - } - @media ${device.mobileL} { - min-width: 100%; - } -`; const MemberList = styled.div` - // justify-content: flex-start; - // padding: 0px 2px; - // margin: 0 0 34px 0; - flex: 1; - // background: red; - width: 100%; + flex: 1; + width: 100%; + margin-bottom:40px; `; const MultipleMemberList = styled.div` - // overflow-y: auto; height: fit-content; max-height: 216px; padding: 0px 2px; - // overflow-x: hidden; width: 100%; &::-webkit-scrollbar-track { - background-color: ${(props) => props.theme.scrollBg}; + background-color: ${(props) => props.theme.scrollbarColor}; } &::-webkit-scrollbar { - background-color: ${(props) => props.theme.scrollBg}; + background-color: ${(props) => props.theme.scrollbarColor}; width: 6px; } @@ -362,19 +242,24 @@ const MultipleMemberList = styled.div` `; const ModalConfirmButton = styled.button<ModalButtonProps>` - margin: 60px 0 0 0; - background: ${(props) => props.memberListCount ? '#CF1C84' : props.theme.groupButtonBackgroundColor}; - color: ${(props) => props.memberListCount ? '#fff' : props.theme.groupButtonTextColor}; - border: ${(props) => props.memberListCount ? 'none' : props.theme.modalConfirmButtonBorder}; - min-width: 50%; - box-sizing: border-box; - cursor: pointer; - border-radius: 15px; - padding: 16px; - font-size: 1.125rem; - font-weight: 500; - display: flex; - align-items: center; - justify-content: center; - box-shadow: none; -`; \ No newline at end of file + margin: 60px 0 0 0; + width: 197px; + background: ${(props) => + props.memberListCount ? props.theme.backgroundColor.buttonBackground : props.theme.backgroundColor.buttonDisableBackground}; + color: ${(props) => + props.memberListCount ? props.theme.textColor.buttonText : props.theme.textColor.buttonDisableText}; + border: ${(props) => + props.memberListCount ? 'none' : props.theme.border.modal}; + min-width: 50%; + box-sizing: border-box; + cursor: pointer; + border-radius: 12px; + padding: 16px; + font-size: 16px; + font-weight: 500; + display: flex; + align-items: center; + justify-content: center; + box-shadow: none; + height: 48px; +`; diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx index 4949a44b6..fa6d4e27b 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/ChatProfile.tsx @@ -1,182 +1,230 @@ // @typescript-eslint/no-non-null-asserted-optional-chain -import { useContext, useEffect, useRef, useState } from "react"; -import { Image, Section, Span } from "../../reusables"; -import styled from "styled-components"; -import TokenGatedIcon from '../../../icons/Token-Gated.svg'; +import { useContext, useEffect, useRef, useState } from 'react'; + +import styled from 'styled-components'; +import type { IUser } from '@pushprotocol/restapi'; +import { ethers } from 'ethers'; +import { ToastContainer } from 'react-toastify'; + +import { Image, Section, Span } from '../../reusables'; +import { useChatData, useClickAway } from '../../../hooks'; +import { ThemeContext } from '../theme/ThemeProvider'; +import useGetGroupByID from '../../../hooks/chat/useGetGroupByID'; +import useChatProfile from '../../../hooks/chat/useChatProfile'; +import { GroupInfoModal } from './GroupInfoModal'; +import useMediaQuery from '../../../hooks/useMediaQuery'; +import { createBlockie } from '../../space/helpers/blockies'; +import { ProfileContainer } from '../reusables'; +import 'react-toastify/dist/ReactToastify.min.css'; + +import { IGroup } from '../../../types'; +import { isValidETHAddress } from '../helpers/helper'; +import { IChatProfile, IChatTheme } from '../exportedTypes'; +import { InfuraAPIKey, allowedNetworks, device } from '../../../config'; +import { resolveNewEns, shortenText } from '../../../helpers'; +import TokenGatedIcon from '../../../icons/TokenGatedIcon.svg'; import PublicChatIcon from '../../../icons/Public-Chat.svg'; -import VideoChatIcon from '../../../icons/VideoCallIcon.svg'; import GreyImage from '../../../icons/greyImage.png'; import InfoIcon from '../../../icons/infodark.svg'; import VerticalEllipsisIcon from '../../../icons/VerticalEllipsis.svg'; -import type { IUser } from '@pushprotocol/restapi'; -import { useChatData, useClickAway, useDeviceWidthCheck } from "../../../hooks"; -import { ThemeContext } from "../theme/ThemeProvider"; -import { IChatTheme } from "../theme"; -import { pCAIP10ToWallet, resolveEns, resolveNewEns, shortenText } from "../../../helpers"; -import useGetGroupByID from "../../../hooks/chat/useGetGroupByID"; -import useChatProfile from "../../../hooks/chat/useChatProfile"; -import { IGroup } from "../../../types"; -import { GroupInfoModal } from "./GroupInfoModal"; -import { isValidETHAddress } from "../helpers/helper"; -import { ethers } from "ethers"; -import { IChatProfile, IToast, OptionProps } from "../exportedTypes"; -import { InfuraAPIKey, allowedNetworks, device } from "../../../config"; -import Toast from "../helpers/Toast"; -import useMediaQuery from "../helpers/useMediaQuery"; -import { createBlockie } from "../../space/helpers/blockies"; -// import { NewToast } from "../helpers/NewToast"; -import { ToastContainer, toast } from 'react-toastify'; -import 'react-toastify/dist/ReactToastify.min.css'; - - -const Options = ({ options, setOptions, isGroup, chatInfo, groupInfo, setGroupInfo,theme }: OptionProps) => { - const DropdownRef = useRef(null); - const [modal, setModal] = useState(false); - - useClickAway(DropdownRef, () => { - setOptions(false); - }); - const ShowModal = () => { - setModal(true); - } - - if (groupInfo && isGroup){ - return ( - <Section zIndex="300" flexDirection="row" gap="10px" margin="0 20px 0 auto"> - <Image src={TokenGatedIcon} height="28px" maxHeight="32px" width={'auto'} /> - - {groupInfo?.isPublic && - (<Image src={PublicChatIcon} height="28px" maxHeight="32px" width={'auto'} />)} - - <ImageItem onClick={() => setOptions(true)}> - <Image src={VerticalEllipsisIcon} height="21px" maxHeight="32px" width={'auto'} cursor="pointer" /> - - {options && - (<DropDownBar theme={theme} ref={DropdownRef}> - <DropDownItem cursor='pointer' onClick={ShowModal}> - <Image src={InfoIcon} height="21px" maxHeight="21px" width={'auto'} cursor="pointer" /> - - <TextItem> - Group Info - </TextItem> - </DropDownItem> - </DropDownBar>)} - - {modal && - (<GroupInfoModal - theme={theme} - modal={modal} - setModal={setModal} - groupInfo={groupInfo} - setGroupInfo={setGroupInfo} - />)} - </ImageItem> - </Section> - ) - } else { - return null } - }; - - - - - -export const ChatProfile: React.FC<IChatProfile> = ({ chatId, style }: {chatId: string, style: "Info" | "Preview"}) => { - const theme = useContext(ThemeContext); - const { account, env } = useChatData(); - const { getGroupByID } = useGetGroupByID(); - const { fetchUserChatProfile } = useChatProfile(); - - const [isGroup, setIsGroup] = useState<boolean>(false); - const [options, setOptions] = useState(false); - const [chatInfo, setChatInfo ] = useState<IUser | null>(); - const [groupInfo, setGroupInfo ] = useState<IGroup | null>(); - const [ensName, setEnsName ] = useState<string | undefined>(''); - const isMobile = useMediaQuery(device.tablet); - const l1ChainId = allowedNetworks[env].includes(1) ? 1 : 5; - const provider = new ethers.providers.InfuraProvider(l1ChainId, InfuraAPIKey); - - - - const fetchProfileData = async () => { - if(isValidETHAddress(chatId)){ - const ChatProfile = await fetchUserChatProfile({ profileId: chatId }); - setChatInfo(ChatProfile); - setGroupInfo(null); - setIsGroup(false); - } else { - const GroupProfile = await getGroupByID({ groupId : chatId}) - setGroupInfo(GroupProfile); - setChatInfo(null); - setIsGroup(true); - } +type OptionProps = { + options: boolean; + setOptions: React.Dispatch<React.SetStateAction<boolean>>; + isGroup: boolean; + groupInfo: IGroup | null | undefined; + setGroupInfo: React.Dispatch<React.SetStateAction<IGroup | null | undefined>>; + theme: IChatTheme; +}; + +const Options = ({ + options, + setOptions, + isGroup, + groupInfo, + setGroupInfo, + theme, +}: OptionProps) => { + const DropdownRef = useRef(null); + const [modal, setModal] = useState(false); + + useClickAway(DropdownRef, () => { + setOptions(false); + }); + + const ShowModal = () => { + setModal(true); + }; + + if (groupInfo && isGroup) { + return ( + <Section + zIndex="300" + flexDirection="row" + gap="10px" + margin="0 20px 0 auto" + > + {/* {(groupInfo?.rules?.chat?.conditions || groupInfo.rules?.entry?.conditions) && ( + <Image + src={TokenGatedIcon} + height="24px" + maxHeight="24px" + width={'auto'} + /> + )} */} + <Image + src={groupInfo?.isPublic ? PublicChatIcon : TokenGatedIcon} + height="28px" + maxHeight="32px" + width={'auto'} + /> + + <ImageItem onClick={() => setOptions(true)}> + <Image + src={VerticalEllipsisIcon} + height="21px" + maxHeight="32px" + width={'auto'} + cursor="pointer" + /> + + {options && ( + <DropDownBar theme={theme} ref={DropdownRef}> + <DropDownItem cursor="pointer" onClick={ShowModal}> + <Image + src={InfoIcon} + height="21px" + maxHeight="21px" + width={'auto'} + cursor="pointer" + /> + + <TextItem cursor="pointer">Group Info</TextItem> + </DropDownItem> + </DropDownBar> + )} + + {modal && ( + <GroupInfoModal + theme={theme} + setModal={setModal} + groupInfo={groupInfo} + setGroupInfo={setGroupInfo} + /> + )} + </ImageItem> + </Section> + ); + } else { + return null; + } +}; + +export const ChatProfile: React.FC<IChatProfile> = ({ + chatId, + style, +}: { + chatId: string; + style: 'Info' | 'Preview'; +}) => { + const theme = useContext(ThemeContext); + const { account, env } = useChatData(); + const { getGroupByID } = useGetGroupByID(); + const { fetchUserChatProfile } = useChatProfile(); + + const [isGroup, setIsGroup] = useState<boolean>(false); + const [options, setOptions] = useState(false); + const [chatInfo, setChatInfo] = useState<IUser | null>(); + const [groupInfo, setGroupInfo] = useState<IGroup | null>(); + const [ensName, setEnsName] = useState<string | undefined>(''); + const isMobile = useMediaQuery(device.tablet); + const l1ChainId = allowedNetworks[env].includes(1) ? 1 : 5; + const provider = new ethers.providers.InfuraProvider(l1ChainId, InfuraAPIKey); + + const fetchProfileData = async () => { + if (isValidETHAddress(chatId)) { + const ChatProfile = await fetchUserChatProfile({ profileId: chatId }); + const result = await resolveNewEns(chatId, provider); + setEnsName(result); + setChatInfo(ChatProfile); + setGroupInfo(null); + setIsGroup(false); + } else { + const GroupProfile = await getGroupByID({ groupId: chatId }); + setGroupInfo(GroupProfile); + setChatInfo(null); + setIsGroup(true); } - - const getName = async (chatId: string) => { - if(isValidETHAddress(chatId)){ - const result = await resolveNewEns(chatId, provider); - // if(result) - console.log(result); - setEnsName(result); - } + }; + + const getImage = () => { + if (chatInfo || groupInfo) { + return isGroup + ? groupInfo?.groupImage ?? GreyImage + : chatInfo?.profile?.picture ?? + createBlockie?.(chatId)?.toDataURL()?.toString(); + } else { + return createBlockie?.(chatId)?.toDataURL()?.toString(); } - - - useEffect(()=> { - if(!chatId) return; - fetchProfileData(); - getName(chatId); - },[chatId, account, env]) - - if (chatId && style === 'Info') { - return ( - <Container theme={theme}> - {chatInfo || groupInfo ? ( - <Image src={isGroup ? groupInfo?.groupImage ?? GreyImage : chatInfo?.profile?.picture ?? createBlockie?.(chatId)?.toDataURL() - ?.toString()} height="48px" maxHeight="48px" width={'auto'} borderRadius="100%" /> - ) : (<Image src={createBlockie?.(chatId)?.toDataURL() - ?.toString()} height="48px" maxHeight="48px" width={'auto'} borderRadius="100%" />)} - - - <Span color={theme.textColorPrimary} fontSize="17px" margin="0 0 0 10px"> - {isGroup ? groupInfo?.groupName : ensName ? `${ensName} (${isMobile ? shortenText(chatInfo?.did?.split(':')[1] ?? '', 4, true) : chatId})`: chatInfo ? shortenText(chatInfo.did?.split(':')[1] ?? '', 6, true) : shortenText(chatId,6, true)} - - </Span> - - <Options - options={options} - setOptions={setOptions} - isGroup={isGroup} - chatInfo={chatInfo} - groupInfo={groupInfo} - setGroupInfo={setGroupInfo} - theme={theme} - /> - - {/* {!isGroup && + }; + + const getProfileName = () => { + return isGroup + ? groupInfo?.groupName + : ensName + ? `${ensName} (${isMobile + ? shortenText(chatInfo?.did?.split(':')[1] ?? '', 4, true) + : chatId + })` + : chatInfo + ? shortenText(chatInfo.did?.split(':')[1] ?? '', 6, true) + : shortenText(chatId, 6, true); + }; + + useEffect(() => { + if (!chatId) return; + fetchProfileData(); + }, [chatId, account, env]); + + if (chatId && style === 'Info') { + return ( + <Container theme={theme}> + <ProfileContainer + theme={theme} + member={{ wallet: getProfileName() as string, image: getImage() }} + customStyle={{ fontSize: '17px' }} + /> + + <Options + options={options} + setOptions={setOptions} + isGroup={isGroup} + groupInfo={groupInfo} + setGroupInfo={setGroupInfo} + theme={theme} + /> + + {/* {!isGroup && <VideoChatSection> <Image src={VideoChatIcon} height="18px" maxHeight="18px" width={'auto'} /> </VideoChatSection> } */} - <ToastContainer /> - - - </Container> - ) - } else { - return null; - } -} - + <ToastContainer /> + </Container> + ); + } else { + return null; + } +}; const Container = styled.div` width: 100%; - background: ${(props) => props.theme.bgColorPrimary}; - border-radius: 32px; + background: ${(props) => props.theme.backgroundColor.chatProfileBackground}; + border: ${(props) => props.theme.border?.chatProfile}; + border-radius: ${(props) => props.theme.borderRadius?.chatProfile}; display: flex; flex-direction: row; align-items: center; @@ -189,28 +237,21 @@ const ImageItem = styled.div` position: relative; `; -const DummyImage = styled.div` - height: 48px; - width: 48px; - border-radius: 100%; - background: #ccc; -`; - const DropDownBar = styled.div` - position: absolute; - top: 30px; - left: -130px; - display: block; - min-width: 140px; - color: rgb(101, 119, 149); - border: ${(props) => `1px solid ${props.theme.defaultBorder}`}; - background: ${(props) => props.theme.bgColorPrimary}; - z-index: 10; - border-radius: 16px; + position: absolute; + top: 30px; + left: -130px; + display: block; + min-width: 140px; + color: rgb(101, 119, 149); + background: ${(props) => props.theme.backgroundColor.modalBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; + z-index: 10; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; `; const VideoChatSection = styled.div` - margin: 0 25px 0 auto; + margin: 0 25px 0 auto; `; const DropDownItem = styled(Span)` @@ -225,17 +266,8 @@ const DropDownItem = styled(Span)` `; const TextItem = styled(Span)` - white-space: nowrap; - overflow: hidden; + white-space: nowrap; + overflow: hidden; `; - - - - - - - - - - +//auto update members when an user accepts not done diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx index c5a03ca8b..aca69ae8f 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/GroupInfoModal.tsx @@ -1,635 +1,969 @@ -import { useRef, useState } from "react"; -import styled from "styled-components"; -import { useChatData, useClickAway } from "../../../hooks"; -import { IGroup } from "../../../types"; -import { IChatTheme } from "../theme"; -import * as PushAPI from '@pushprotocol/restapi'; -import { IToast, ShadowedProps, UpdateGroupType } from "../exportedTypes"; -import { convertToWalletAddressList, getAdminList, getUpdatedAdminList, getUpdatedMemberList } from "../helpers/helper"; -import { DropdownValueType } from "./DropDown"; +import { useEffect, useRef, useState } from 'react'; + +import styled from 'styled-components'; +import { MdCheckCircle, MdError } from 'react-icons/md'; + +import { useChatData, useClickAway } from '../../../hooks'; +import { DropdownValueType } from '../reusables/DropDown'; +import { Section, Span, Image, Div } from '../../reusables/sharedStyling'; +import { AddWalletContent } from './AddWalletContent'; +import { Modal, ModalHeader } from '../reusables'; +import useMediaQuery from '../../../hooks/useMediaQuery'; +import useToast from '../reusables/NewToast'; +import useUpdateGroup from '../../../hooks/chat/useUpdateGroup'; +import { MemberProfileCard } from './MemberProfileCard'; +import { ProfileContainer } from '../reusables'; + +import { IGroup } from '../../../types'; +import { IChatTheme } from '../theme'; +import { device } from '../../../config'; +import { + convertToWalletAddressList, + getAdminList, + getUpdatedAdminList, + getUpdatedMemberList, + isAccountOwnerAdmin, +} from '../helpers/group'; +import LockIcon from '../../../icons/Lock.png'; +import LockSlashIcon from '../../../icons/LockSlash.png'; +import ArrowIcon from '../../../icons/CaretUp.svg'; +import addIcon from '../../../icons/addicon.svg'; import DismissAdmin from '../../../icons/dismissadmin.svg'; import AddAdmin from '../../../icons/addadmin.svg'; import Remove from '../../../icons/remove.svg'; -import { Section, Span, Image } from "../../reusables/sharedStyling"; -import CloseIcon from '../../../icons/close.svg'; -import { ProfileCard } from "./ProfileCard"; -import addIcon from '../../../icons/addicon.svg'; -import { pCAIP10ToWallet, shortenText } from "../../../helpers"; -import LockIcon from '../../../icons/Lock.png' -import LockSlashIcon from '../../../icons/LockSlash.png' -import { AddWalletContent } from './AddWalletContent' -import ArrowIcon from '../../../icons/CaretDown.svg' -import { Modal } from "../helpers/Modal"; -import { device } from "../../../config"; -import useMediaQuery from "../helpers/useMediaQuery"; -import useToast from "../helpers/NewToast"; -import { MdCheckCircle, MdError } from "react-icons/md"; - - +import { shortenText } from '../../../helpers'; +import TokenGatedIcon from '../../../icons/TokenGatedIcon.svg'; +import ConditionsComponent from '../CreateGroup/ConditionsComponent'; +import { ConditionArray } from '../exportedTypes'; +import { ACCESS_TYPE_TITLE } from '../constants'; + +const UPDATE_KEYS = { + REMOVE_MEMBER: 'REMOVE_MEMBER', + ADD_MEMBER: 'ADD_MEMBER', + REMOVE_ADMIN: 'REMOVE_ADMIN', + ADD_ADMIN: 'ADD_ADMIN', +} as const; + +type UpdateKeys = typeof UPDATE_KEYS[keyof typeof UPDATE_KEYS]; +const SUCCESS_MESSAGE = { + REMOVE_MEMBER: 'Removed Member successfully', + ADD_MEMBER: 'Group Invitation sent', + REMOVE_ADMIN: 'Admin added successfully', + ADD_ADMIN: 'Removed added successfully', +}; + +type PendingMembersProps = { + groupInfo?: IGroup | null; + setShowPendingRequests: React.Dispatch<React.SetStateAction<boolean>>; + showPendingRequests: boolean; + theme: IChatTheme; +}; + +interface ShadowedProps { + setPosition: boolean; +} -const PendingMembers = ({ groupInfo, setShowPendingRequests, showPendingRequests, theme }: {groupInfo?: IGroup | null, setShowPendingRequests: React.Dispatch<React.SetStateAction<boolean>>, showPendingRequests: boolean, theme: IChatTheme }) => { - if(groupInfo){ +const PendingMembers = ({ + groupInfo, + setShowPendingRequests, + showPendingRequests, + theme, +}: PendingMembersProps) => { + if (groupInfo) { return ( - <PendingRequestWrapper - theme={theme} + <PendingRequestWrapper theme={theme}> + <PendingSection + onClick={() => setShowPendingRequests(!showPendingRequests)} > - <PendingSection onClick={() => setShowPendingRequests(!showPendingRequests)}> - <Span fontSize='18px' color={theme.modalProfileTextColor}>Pending Requests</Span> - <Badge>{groupInfo?.pendingMembers?.length}</Badge> - - <ArrowImage src={ArrowIcon} height="20px" maxHeight="20px" width={'auto'} setPosition={showPendingRequests} borderRadius='100%' /> - {/* <ArrowImage src={theme === 'light' ? ArrowGreyIcon : ArrowIcon} height="20px" maxHeight="20px" width={'auto'} setPosition={showPendingRequests} borderRadius='100%' /> */} + <Span fontSize="18px" color={theme.textColor?.modalSubHeadingText}> + Pending Requests + </Span> + <Badge>{groupInfo?.pendingMembers?.length}</Badge> + + <ArrowImage + src={ArrowIcon} + width={'auto'} + setPosition={!showPendingRequests} + borderRadius="100%" + /> </PendingSection> - {showPendingRequests && ( - <Section margin='0px 0px 0px 0px' flexDirection='column' flex='1' borderRadius="16px"> - {groupInfo?.pendingMembers && groupInfo?.pendingMembers?.length > 0 && groupInfo?.pendingMembers.map((item) => ( - <GroupPendingMembers theme={theme}> - <Image src={item?.image} height="36px" maxHeight="36px" width={'auto'} borderRadius='100%' /> - - <Span margin='0 0 0 10px'> - {shortenText(item?.wallet?.split(':')[1] ?? '', 6, true)} - </Span> + {showPendingRequests && ( + <Section + margin="0px 0px 0px 0px" + flexDirection="column" + flex="1" + borderRadius="16px" + > + {groupInfo?.pendingMembers && + groupInfo?.pendingMembers?.length > 0 && + groupInfo?.pendingMembers.map((item) => ( + <GroupPendingMembers theme={theme}> + <ProfileContainer + theme={theme} + member={{ + wallet: shortenText(item.wallet?.split(':')[1], 6, true), + image: item?.image || '', + }} + customStyle={{ + imgHeight: '36px', + imgMaxHeight: '36px', + fontSize: 'inherit', + fontWeight: '300', + }} + /> + </GroupPendingMembers> + ))} + </Section> + )} + </PendingRequestWrapper> + ); + } else { + return null; + } +}; + +const dummyConditonsData: ConditionArray[] = [ + [{ operator: 'any' }], + [ + { + type: 'PUSH', + category: 'ERC20', + subcategory: 'holder', + data: { + contract: 'eip155:1:0xf418588522d5dd018b425E472991E52EBBeEEEEE', + amount: 1, + decimals: 18, + }, + }, + ], + [ + { operator: 'all' }, + { + type: 'PUSH', + category: 'ERC20', + subcategory: 'holder', + data: { + contract: 'eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1', + amount: 1, + decimals: 18, + }, + }, + { + type: 'PUSH', + category: 'ERC721', + subcategory: 'holder', + data: { + contract: 'eip155:137:0x58001cC1A9E17A20935079aB40B1B8f4Fc19EFd1', + amount: 1, + decimals: 18, + }, + }, + { + type: 'GUILD', + category: 'ROLES', + subcategory: 'DEFAULT', + data: { + id: '1', + role: '346243', + comparison: 'all', + }, + }, + ], + // [ + // { operator: 'any' }, + // { + // type: 'PUSH', + // category: 'INVITE', + // subcategory: 'DEFAULT', + // data: { + // inviterRoles: 'ADMIN', + // }, + // }, + // { + // type: 'PUSH', + // category: 'INVITE', + // subcategory: 'DEFAULT', + // data: { + // inviterRoles: 'OWNER', + // }, + // }, + // ], +]; + +const dummySingleCondtionData: ConditionArray[] = dummyConditonsData[2].map( + (criteria) => [criteria] +); + +interface ConditionsInformationProps { + theme: IChatTheme; + groupInfo?: IGroup | null; +} - </GroupPendingMembers> - ))} +export const ConditionsInformation = ({ + theme, + groupInfo, +}: ConditionsInformationProps) => { + return ( + <Section + margin="15px 0px 0px 0px" + gap="20px" + flexDirection="column" + width="100%" + > + {(groupInfo?.rules?.chat?.conditions || + groupInfo?.rules?.entry?.conditions) && ( + <GroupTypeBadge + theme={theme} + icon={TokenGatedIcon} + header={'Gated group'} + subheader={'Conditions must be true to join'} + /> + )} + {Object.keys(ACCESS_TYPE_TITLE).map((key) => ( + <> + <Span fontSize="16px" fontWeight="500" alignSelf="start"> + { ACCESS_TYPE_TITLE[key as keyof typeof ACCESS_TYPE_TITLE]?.heading} + </Span> + <ConditionSection + width="100%" + overflow="hidden auto" + maxHeight="12rem" + theme={theme} + padding="0 4px 0 0" + > + <ConditionsComponent + moreOptions={false} + conditionData={dummyConditonsData} + /> + </ConditionSection> + </> + ))} </Section> - )} - </PendingRequestWrapper> - ) - } else {return null } + ); +}; + +interface GroupTypeProps { + theme: IChatTheme; + icon: string; + header: string; + subheader: string; + cursor?: string; + handleNextInformation?: () => void; } -export const GroupInfoModal = ({ theme, modal, setModal, groupInfo, setGroupInfo }: { theme: IChatTheme, modal: boolean, setModal: React.Dispatch<React.SetStateAction<boolean>>, groupInfo: IGroup, setGroupInfo: React.Dispatch<React.SetStateAction<IGroup | null | undefined>> }) => { - const { account, env, pgpPrivateKey } = useChatData(); - const [showAddMoreWalletModal, setShowAddMoreWalletModal] = useState<boolean>(false); - const [showPendingRequests, setShowPendingRequests] = useState<boolean>(false); - const [memberList, setMemberList] = useState<any>([]); - const [isLoading, setIsLoading] = useState<boolean>(false); - const [selectedMemberAddress, setSelectedMemberAddress] = useState<string | null>(null); - - const handleClose = () => onClose(); - const dropdownRef = useRef<any>(null); - useClickAway(dropdownRef, () => setSelectedMemberAddress(null)); - const groupInfoToast = useToast(); - - - const groupCreator = groupInfo?.groupCreator; - const membersExceptGroupCreator = groupInfo?.members?.filter((x) => x.wallet?.toLowerCase() !== groupCreator?.toLowerCase()); - const groupMembers = [...membersExceptGroupCreator, ...groupInfo.pendingMembers]; - - - const updateGroup = async (options:UpdateGroupType) => { - const { groupInfo, connectedUser,adminList,memberList } = options; - const updateResponse = await PushAPI.chat.updateGroup({ - chatId: groupInfo?.chatId, - groupName: groupInfo?.groupName, - groupDescription: groupInfo?.groupDescription ?? '', - groupImage: groupInfo?.groupImage, - members: memberList, - admins: adminList, - account: connectedUser?.wallets, - pgpPrivateKey: pgpPrivateKey, - env: env, +const GroupTypeBadge = ({ + theme, + icon, + header, + subheader, + handleNextInformation, + cursor, +}: GroupTypeProps) => { + return ( + <Section cursor={cursor}> + <PublicEncrypted onClick={handleNextInformation} theme={theme}> + <Image + cursor={cursor} + src={icon} + height="24px" + maxHeight="24px" + width={'auto'} + /> + + <Section + cursor={cursor} + flexDirection="column" + alignItems="flex-start" + gap="5px" + > + <Span + cursor={cursor} + fontSize="18px" + color={theme.textColor?.modalHeadingText} + > + {header} + </Span> + <Span + cursor={cursor} + fontSize="12px" + color={theme.textColor?.modalSubHeadingText} + > + {subheader} + </Span> + </Section> + </PublicEncrypted> + </Section> + ); +}; + +type GroupSectionProps = GroupInfoModalProps & { + handleNextInformation: () => void; + handlePreviousInformation?: () => void; +}; + +type GroupInfoModalProps = { + theme: IChatTheme; + setModal: React.Dispatch<React.SetStateAction<boolean>>; + groupInfo: IGroup; + setGroupInfo: React.Dispatch<React.SetStateAction<IGroup | null | undefined>>; +}; + +export const GROUPINFO_STEPS = { + GROUP_INFO: 1, + CRITERIA: 2, +} as const; + +export type GROUP_INFO_TYPE = + typeof GROUPINFO_STEPS[keyof typeof GROUPINFO_STEPS]; + +const GroupInformation = ({ + theme, + setModal, + groupInfo, + setGroupInfo, + handleNextInformation, +}: GroupSectionProps) => { + const { account } = useChatData(); + const [showAddMoreWalletModal, setShowAddMoreWalletModal] = + useState<boolean>(false); + const [showPendingRequests, setShowPendingRequests] = + useState<boolean>(false); + const [memberList, setMemberList] = useState<any>([]); + const [isLoading, setIsLoading] = useState<boolean>(false); + const [checkedValue, setchecked] = useState<boolean>(false); + const [selectedMemberAddress, setSelectedMemberAddress] = useState< + string | null + >(null); + const { updateGroup } = useUpdateGroup(); + const isMobile = useMediaQuery(device.mobileL); + + const handleClose = () => onClose(); + const dropdownRef = useRef<any>(null); + useClickAway(dropdownRef, () => setSelectedMemberAddress(null)); + const groupInfoToast = useToast(); + + const groupCreator = groupInfo?.groupCreator; + const membersExceptGroupCreator = groupInfo?.members?.filter( + (x) => x.wallet?.toLowerCase() !== groupCreator?.toLowerCase() + ); + + const groupMembers = [ + ...membersExceptGroupCreator, + ...groupInfo.pendingMembers, + ]; + + type UpdateGroupType = { + adminList: Array<string>; + memberList: Array<string>; + }; + + const handleUpdateGroup = async (options: UpdateGroupType) => { + const { adminList, memberList } = options || {}; + const updateResponse = await updateGroup({ + groupInfo, + memberList, + adminList, + }); + return { updateResponse }; + }; + + const handleAddRemove = async ( + options: UpdateGroupType & { updateKey: UpdateKeys } + ) => { + const { adminList, memberList, updateKey } = options || {}; + + try { + setIsLoading(true); + const { updateResponse } = await handleUpdateGroup({ + adminList, + memberList, + }); + + if (typeof updateResponse !== 'string') { + setGroupInfo(updateResponse); + + groupInfoToast.showMessageToast({ + toastTitle: 'Success', + toastMessage: SUCCESS_MESSAGE[updateKey], + toastType: 'SUCCESS', + getToastIcon: (size) => <MdCheckCircle size={size} color="green" />, }); - let updatedCurrentChat = null; - if(typeof updateResponse !== 'string') - { - updatedCurrentChat = groupInfo; - updatedCurrentChat = updateResponse; - } - return {updateResponse,updatedCurrentChat}; + } else { + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: updateResponse, + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + } + } catch (error) { + console.error('Error', error); + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: 'Please, try again', + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + } finally { + if (updateKey === UPDATE_KEYS.ADD_MEMBER) handleClose(); + setIsLoading(false); + setSelectedMemberAddress(null); } - - const addMembers = async () => { - //Already Present Members and PendingMembers - const groupMemberList = convertToWalletAddressList([ - ...groupInfo.members, - ...groupInfo.pendingMembers, - ]); - - //Newly Added Members and alreadyPresent Members in the groupchat - const newMembersToAdd = memberList.map((member: any) => member.wallets); - const members = [...groupMemberList, ...newMembersToAdd]; - - //Admins wallet address from both members and pendingMembers - const adminList = getAdminList?.(groupInfo); - - - try { - setIsLoading(true); - const connectedUser = await PushAPI.user.get({ account: account as string, env }); - const { updateResponse, updatedCurrentChat } = await updateGroup({ - groupInfo, - connectedUser, - adminList, - memberList: members, - }); - - if (typeof updateResponse !== 'string') { - setSelectedMemberAddress(null); - setGroupInfo(updateResponse); - } else { - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: updateResponse, - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - setSelectedMemberAddress(null); - } - setIsLoading(false); - groupInfoToast.showMessageToast({ - toastTitle: 'Success', - toastMessage: 'Group Invitation sent', - toastType: 'SUCCESS', - getToastIcon: (size) => ( - <MdCheckCircle - size={size} - color="green" - /> - ), - }); - handleClose(); - } catch (error) { - setIsLoading(false); - console.log('Error', error); - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: 'Please, try again', - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - } - }; - - - const makeGroupAdmin = async () => { - const groupMemberList = convertToWalletAddressList([ - ...groupInfo.members, - ...groupInfo.pendingMembers, - ]); - const newAdminList = getUpdatedAdminList(groupInfo, selectedMemberAddress, false); - try { - const connectedUser = await PushAPI.user.get({ account: account as string, env }); - const { updateResponse, updatedCurrentChat } = await updateGroup({ - groupInfo, - connectedUser, - adminList: newAdminList, - memberList: groupMemberList, - }); - if (typeof updateResponse !== 'string') { - setSelectedMemberAddress(null); - setGroupInfo(updateResponse); - - groupInfoToast.showMessageToast({ - toastTitle: 'Success', - toastMessage: 'Admin added successfully', - toastType: 'SUCCESS', - getToastIcon: (size) => ( - <MdCheckCircle - size={size} - color="green" - />), - }); - } else { - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: updateResponse, - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - setSelectedMemberAddress(null); - } - } catch (e) { - console.error('Error while adding admin', e); - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: 'Error', - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - } - setSelectedMemberAddress(null); - }; - - const dismissGroupAdmin = async () => { - const groupMemberList = convertToWalletAddressList([ - ...groupInfo.members, - ...groupInfo.pendingMembers, - ]); - const newAdminList = getUpdatedAdminList(groupInfo, selectedMemberAddress, true); - try { - const connectedUser = await PushAPI.user.get({ account: account as string, env }); - const { updateResponse, updatedCurrentChat } = await updateGroup({ - groupInfo, - connectedUser, - adminList: newAdminList, - memberList: groupMemberList, - }); - if (typeof updateResponse !== 'string') { - setSelectedMemberAddress(null); - setGroupInfo(updateResponse); - - groupInfoToast.showMessageToast({ - toastTitle: 'Success', - toastMessage: 'Admin removed successfully', - toastType: 'SUCCESS', - getToastIcon: (size) => ( - <MdCheckCircle - size={size} - color="green" - />), - }); - - } else { - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: updateResponse, - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - setSelectedMemberAddress(null); - } - } catch (e) { - console.error('Error while dismissing admin', e); - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: 'Please, try again', - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - } - setSelectedMemberAddress(null); - }; - - const removeMember = async () => { - const updatedMemberList = getUpdatedMemberList(groupInfo, selectedMemberAddress!); - const adminList = getUpdatedAdminList(groupInfo, selectedMemberAddress, true); - try { - const connectedUser = await PushAPI.user.get({ account: account as string, env }); - const { updateResponse, updatedCurrentChat } = await updateGroup({ - groupInfo, - connectedUser, - adminList, - memberList: updatedMemberList, - }); - - if (typeof updateResponse !== 'string') { - setSelectedMemberAddress(null); - setGroupInfo(updateResponse); - - groupInfoToast.showMessageToast({ - toastTitle: 'Success', - toastMessage: 'Removed Member successfully', - toastType: 'SUCCESS', - getToastIcon: (size) => ( - <MdCheckCircle - size={size} - color="green" - /> - ), - }); - } else { - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: updateResponse, - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); - setSelectedMemberAddress(null); - } - } catch (error) { - console.error('Error in removing member', error); - groupInfoToast.showMessageToast({ - toastTitle: 'Error', - toastMessage: 'Please, try again', - toastType: 'ERROR', - getToastIcon: (size) => ( - <MdError - size={size} - color="red" - /> - ), - }); + }; + const removeMember = async () => { + const updatedMemberList = getUpdatedMemberList( + groupInfo, + selectedMemberAddress! + ); + const adminList = getUpdatedAdminList( + groupInfo, + selectedMemberAddress, + true + ); + await handleAddRemove({ + memberList: updatedMemberList, + adminList, + updateKey: UPDATE_KEYS.REMOVE_MEMBER, + }); + }; + + const addMembers = async () => { + //Already Present Members and PendingMembers + const groupMemberList = convertToWalletAddressList([ + ...groupInfo.members, + ...groupInfo.pendingMembers, + ]); + + //Newly Added Members and alreadyPresent Members in the groupchat + const newMembersToAdd = memberList.map((member: any) => member.wallets); + const members = [...groupMemberList, ...newMembersToAdd]; + + //Admins wallet address from both members and pendingMembers + const adminList = getAdminList?.(groupInfo); + + await handleAddRemove({ + memberList: members, + adminList, + updateKey: UPDATE_KEYS.ADD_MEMBER, + }); + }; + + const updateGroupAdmin = async (updateKey: UpdateKeys) => { + const groupMemberList = convertToWalletAddressList([ + ...groupInfo.members, + ...groupInfo.pendingMembers, + ]); + const newAdminList = getUpdatedAdminList( + groupInfo, + selectedMemberAddress, + !(updateKey === UPDATE_KEYS.ADD_ADMIN) + ); + await handleAddRemove({ + memberList: groupMemberList, + adminList: newAdminList, + updateKey, + }); + }; + + // const messageUserDropdown: DropdownValueType = { + // id: 'message_user', + // title: 'Message user', + // icon: Message, + // function: () => messageUser(), + // }; + + const removeAdminDropdown: DropdownValueType = { + id: 'dismiss_admin', + title: 'Dismiss as admin', + icon: DismissAdmin, + function: () => updateGroupAdmin(UPDATE_KEYS.REMOVE_ADMIN), + }; + const addAdminDropdown: DropdownValueType = { + id: 'add_admin', + title: 'Make group admin', + icon: AddAdmin, + function: () => updateGroupAdmin(UPDATE_KEYS.ADD_ADMIN), + }; + const removeMemberDropdown: DropdownValueType = { + id: 'remove_member', + title: 'Remove', + icon: Remove, + function: () => removeMember(), + textColor: '#ED5858', + }; + + //remove all testing things + + const a1: DropdownValueType = { + id: 'dismiss_admin', + title: 'Dismiss as admin', + function: () => updateGroupAdmin(UPDATE_KEYS.REMOVE_ADMIN), + }; + const a2: DropdownValueType = { + id: 'add_admin', + title: 'Make group admin', + function: () => updateGroupAdmin(UPDATE_KEYS.ADD_ADMIN), + }; + + const handlePrevious = () => { + setShowAddMoreWalletModal(false); + }; + + const onClose = (): void => { + setModal(false); + }; + + return ( + <Section width={isMobile ? '100%' : '410px'} flexDirection="column"> + <GroupDescription> + <Span fontSize="18px" color={theme.textColor?.modalHeadingText}> + Group Description + </Span> + <Span + textAlign="start" + fontSize="18px" + color={theme.textColor?.modalSubHeadingText} + > + {groupInfo?.groupDescription} + </Span> + </GroupDescription> + <GroupTypeBadge + theme={theme} + icon={groupInfo?.isPublic ? LockIcon : LockSlashIcon} + header={groupInfo?.isPublic ? 'Open' : 'Encrypted'} + subheader={ + groupInfo?.isPublic + ? 'Chats are not encrypted' + : 'Chats are end-to-end encrypted' } - setSelectedMemberAddress(null); - }; - - // const messageUserDropdown: DropdownValueType = { - // id: 'message_user', - // title: 'Message user', - // icon: Message, - // function: () => messageUser(), - // }; - const removeAdminDropdown: DropdownValueType = { - id: 'dismiss_admin', - title: 'Dismiss as admin', - icon: DismissAdmin, - function: () => dismissGroupAdmin(), - }; - const addAdminDropdown: DropdownValueType = { - id: 'add_admin', - title: 'Make group admin', - icon: AddAdmin, - function: () => makeGroupAdmin(), - }; - const removeMemberDropdown: DropdownValueType = { - id: 'remove_member', - title: 'Remove', - icon: Remove, - function: () => removeMember(), - textColor: '#ED5858', - }; - - - - const isAccountOwnerAdmin = groupInfo?.members?.some( - (member) => pCAIP10ToWallet(member?.wallet)?.toLowerCase() === account?.toLowerCase() && member?.isAdmin - ); - - const handlePrevious = () => { - setShowAddMoreWalletModal(false); - }; - - const onClose = () => { - setModal(false); - } - - const isMobile = useMediaQuery(device.mobileL); - if(groupInfo){ - return( - <Modal clickawayClose={onClose}> - {!showAddMoreWalletModal && (<Section width={isMobile ? '100%' : '410px'} flexDirection='column' padding={isMobile ? '0px auto' :'0px 10px'} > - <Section flex='1' flexDirection='row' justifyContent='space-between'> - - <div></div> - - <Span textAlign='center' fontSize='20px' color={theme.textColorPrimary}>Group Info</Span> - - <Image src={CloseIcon} height="24px" maxHeight="24px" width={'auto'} onClick={()=>onClose()} cursor='pointer' /> - </Section> - - <GroupHeader> - <Image src={groupInfo?.groupImage ?? ''} height="64px" maxHeight="64px" width={'auto'} borderRadius="16px" /> - - <Section flexDirection='column' alignItems='flex-start' gap='5px'> - <Span fontSize='20px' color={theme.textColorPrimary}>{groupInfo?.groupName}</Span> - <Span fontSize='16px' color={theme.modalDescriptionTextColor}>{groupInfo?.members?.length} Members</Span> - </Section> - </GroupHeader> - - <GroupDescription> - <Span fontSize='18px' color={theme.modalProfileTextColor} >Group Description</Span> - <Span fontSize='18px' color={theme.modalDescriptionTextColor}>{groupInfo?.groupDescription}</Span> - </GroupDescription> - - <PublicEncrypted theme={theme}> - <Image src={groupInfo?.isPublic ? LockIcon : LockSlashIcon} height="24px" maxHeight="24px" width={'auto'} /> - - <Section flexDirection='column' alignItems='flex-start' gap='5px'> - <Span fontSize='18px' color={theme.textColorPrimary}>{groupInfo?.isPublic ? 'Public' : 'Private'}</Span> - <Span fontSize='12px' color={theme.modalIconColor}>{groupInfo?.isPublic ? 'Chats are not encrypted' : 'Chats are encrypted'}</Span> - </Section> - </PublicEncrypted> + /> + {/* {(groupInfo.rules?.chat?.conditions || + groupInfo.rules?.entry?.conditions) && ( + <GroupTypeBadge + cursor="pointer" + handleNextInformation={handleNextInformation} + theme={theme} + icon={TokenGatedIcon} + header={'Gated group'} + subheader={'Conditions must be true to join'} + /> + )} */} + + {isAccountOwnerAdmin(groupInfo, account!) && + groupInfo?.members && + groupInfo?.members?.length < 10 && ( + <AddWalletContainer + theme={theme} + onClick={() => setShowAddMoreWalletModal(true)} + > + <Image + cursor="pointer" + src={addIcon} + height="18px" + maxHeight="18px" + width={'auto'} + /> - {isAccountOwnerAdmin && groupInfo?.members && groupInfo?.members?.length < 10 && ( - <AddWalletContainer theme={theme} - onClick={() => setShowAddMoreWalletModal(true)} - > - <Image src={addIcon} height="18px" maxHeight="18px" width={'auto'} /> - - <Span - color={theme.textColorSecondary} - margin="0px 14px" - fontSize="16px" - fontWeight="400" - > - Add more wallets - </Span> - </AddWalletContainer>)} - - <Section borderRadius="16px"> + <Span + cursor="pointer" + color={theme.textColor?.modalSubHeadingText} + margin="0px 14px" + fontSize="16px" + fontWeight="400" + > + Add more wallets + </Span> + </AddWalletContainer> + )} + + <Section borderRadius="16px"> {groupInfo?.pendingMembers?.length > 0 && ( - <PendingMembers - groupInfo={groupInfo} - setShowPendingRequests={setShowPendingRequests} - showPendingRequests={showPendingRequests} - theme={theme} + <PendingMembers + groupInfo={groupInfo} + setShowPendingRequests={setShowPendingRequests} + showPendingRequests={showPendingRequests} + theme={theme} + /> + )} + </Section> + + <Section margin="15px 10px" flexDirection="column" flex="1" zIndex="2"> + {groupInfo?.members && + groupInfo?.members?.length > 0 && + groupInfo?.members.map((item, index) => ( + <MemberProfileCard + key={index} + member={item} + dropdownValues={ + item?.isAdmin && isAccountOwnerAdmin(groupInfo, account!) + ? [removeAdminDropdown, removeMemberDropdown] + : isAccountOwnerAdmin(groupInfo, account!) + ? [addAdminDropdown, removeMemberDropdown] + : [] + } + selectedMemberAddress={selectedMemberAddress} + setSelectedMemberAddress={setSelectedMemberAddress} + dropdownRef={dropdownRef} /> - )} + ))} + </Section> + {showAddMoreWalletModal && ( + <AddWalletContent + onSubmit={addMembers} + handlePrevious={handlePrevious} + onClose={onClose} + memberList={memberList} + handleMemberList={setMemberList} + groupMembers={groupMembers} + isLoading={isLoading} + modalHeader={'Add More Wallets'} + /> + )} </Section> + ); +}; + +export const GroupInfoModal = ({ + theme, + setModal, + groupInfo, + setGroupInfo, +}: GroupInfoModalProps) => { + const [activeComponent, setActiveComponent] = useState<GROUP_INFO_TYPE>( + GROUPINFO_STEPS.GROUP_INFO + ); + const handleNextInfo = () => { + console.log('criteria'); + setActiveComponent((activeComponent + 1) as GROUP_INFO_TYPE); + console.log(activeComponent); + }; + + const handlePreviousInfo = () => { + setActiveComponent((activeComponent - 1) as GROUP_INFO_TYPE); + }; + + const renderComponent = () => { + switch (activeComponent) { + case GROUPINFO_STEPS.GROUP_INFO: + return ( + <GroupInformation + handleNextInformation={handleNextInfo} + theme={theme} + setModal={setModal} + groupInfo={groupInfo} + setGroupInfo={setGroupInfo} + /> + ); + case GROUPINFO_STEPS.CRITERIA: + return <ConditionsInformation groupInfo={groupInfo} theme={theme} />; + + default: + return ( + <GroupInformation + handleNextInformation={handleNextInfo} + theme={theme} + setModal={setModal} + groupInfo={groupInfo} + setGroupInfo={setGroupInfo} + /> + ); + } + }; + const [showAddMoreWalletModal, setShowAddMoreWalletModal] = + useState<boolean>(false); + useState<boolean>(false); + const [memberList, setMemberList] = useState<any>([]); + const [isLoading, setIsLoading] = useState<boolean>(false); + const [selectedMemberAddress, setSelectedMemberAddress] = useState< + string | null + >(null); + const { updateGroup } = useUpdateGroup(); + const isMobile = useMediaQuery(device.mobileL); + + const handleClose = () => onClose(); + const dropdownRef = useRef<any>(null); + useClickAway(dropdownRef, () => setSelectedMemberAddress(null)); + const groupInfoToast = useToast(); + + const groupCreator = groupInfo?.groupCreator; + const membersExceptGroupCreator = groupInfo?.members?.filter( + (x) => x.wallet?.toLowerCase() !== groupCreator?.toLowerCase() + ); + + type UpdateGroupType = { + adminList: Array<string>; + memberList: Array<string>; + }; + + const handleUpdateGroup = async (options: UpdateGroupType) => { + const { adminList, memberList } = options || {}; + const updateResponse = await updateGroup({ + groupInfo, + memberList, + adminList, + }); + return { updateResponse }; + }; + + const handleAddRemove = async ( + options: UpdateGroupType & { updateKey: UpdateKeys } + ) => { + const { adminList, memberList, updateKey } = options || {}; + + try { + setIsLoading(true); + const { updateResponse } = await handleUpdateGroup({ + adminList, + memberList, + }); + + if (typeof updateResponse !== 'string') { + setGroupInfo(updateResponse); + + groupInfoToast.showMessageToast({ + toastTitle: 'Success', + toastMessage: SUCCESS_MESSAGE[updateKey], + toastType: 'SUCCESS', + getToastIcon: (size) => <MdCheckCircle size={size} color="green" />, + }); + } else { + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: updateResponse, + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + } + } catch (error) { + console.error('Error', error); + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: 'Please, try again', + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + } finally { + if (updateKey === UPDATE_KEYS.ADD_MEMBER) handleClose(); + setIsLoading(false); + setSelectedMemberAddress(null); + } + }; + const removeMember = async () => { + const updatedMemberList = getUpdatedMemberList( + groupInfo, + selectedMemberAddress! + ); + const adminList = getUpdatedAdminList( + groupInfo, + selectedMemberAddress, + true + ); + await handleAddRemove({ + memberList: updatedMemberList, + adminList, + updateKey: UPDATE_KEYS.REMOVE_MEMBER, + }); + }; + + const addMembers = async () => { + //Already Present Members and PendingMembers + const groupMemberList = convertToWalletAddressList([ + ...groupInfo.members, + ...groupInfo.pendingMembers, + ]); + + //Newly Added Members and alreadyPresent Members in the groupchat + const newMembersToAdd = memberList.map((member: any) => member.wallets); + const members = [...groupMemberList, ...newMembersToAdd]; + + //Admins wallet address from both members and pendingMembers + const adminList = getAdminList?.(groupInfo); + + await handleAddRemove({ + memberList: members, + adminList, + updateKey: UPDATE_KEYS.ADD_MEMBER, + }); + }; + + const updateGroupAdmin = async (updateKey: UpdateKeys) => { + const groupMemberList = convertToWalletAddressList([ + ...groupInfo.members, + ...groupInfo.pendingMembers, + ]); + const newAdminList = getUpdatedAdminList( + groupInfo, + selectedMemberAddress, + !(updateKey === UPDATE_KEYS.ADD_ADMIN) + ); + await handleAddRemove({ + memberList: groupMemberList, + adminList: newAdminList, + updateKey, + }); + }; + + const onClose = (): void => { + setModal(false); + }; + + if (groupInfo) { + return ( + <Modal clickawayClose={onClose}> + {!showAddMoreWalletModal && ( + <Section + width={isMobile ? '100%' : '410px'} + flexDirection="column" + padding={isMobile ? '0px auto' : '0px 10px'} + > + <ModalHeader + handlePrevious={ + activeComponent == 2 ? handlePreviousInfo : undefined + } + title="Group Info" + handleClose={onClose} + /> - <Section margin='15px 10px' flexDirection='column' flex='1' zIndex="2" > - {groupInfo?.members && groupInfo?.members?.length > 0 && groupInfo?.members.map((item, index) => ( - <ProfileCard - key={index} - member={item} - dropdownValues={ - item?.isAdmin && isAccountOwnerAdmin - ? [removeAdminDropdown, removeMemberDropdown] - : isAccountOwnerAdmin - ? [addAdminDropdown, removeMemberDropdown] - : [] - } - selectedMemberAddress={selectedMemberAddress} - setSelectedMemberAddress={setSelectedMemberAddress} - dropdownRef={dropdownRef} - /> - ))} - </Section> - - </Section>)} - - - - {showAddMoreWalletModal && ( - <AddWalletContent - onSubmit={addMembers} - handlePrevious={handlePrevious} - onClose={onClose} - memberList={memberList} - handleMemberList={setMemberList} - title={'Add More Wallets'} - groupMembers={groupMembers} - isLoading={isLoading} - /> - )} - </Modal> - ) -} else { return null } - -} + <GroupHeader> + <Image + src={groupInfo?.groupImage ?? ''} + height="64px" + maxHeight="64px" + width={'auto'} + borderRadius="16px" + /> -const ProfileDiv = styled.div<{minHeight?: number}>` - display: flex; - flex-direction: column; - justify-content: flex-start; - padding-right: 3px; - align-items: center; - min-width: 445px; - min-height: 72px; - max-height: 216px; - min-height: ${(props) => `${props.minHeight}px`}; - overflow-y: auto; - overflow-x: hidden; - &&::-webkit-scrollbar { - width: 4px; + <Section flexDirection="column" alignItems="flex-start" gap="5px"> + <Span fontSize="20px" color={theme.textColor?.modalHeadingText}> + {groupInfo?.groupName} + </Span> + <Span + fontSize="16px" + color={theme.textColor?.modalSubHeadingText} + > + {groupInfo?.members?.length} Members + </Span> + </Section> + </GroupHeader> + {renderComponent()} + </Section> + )} + </Modal> + ); + } else { + return null; } - &&::-webkit-scrollbar-thumb { - background: #cf1c84; - border-radius: 10px; - } - @media (max-width: 480px) { - min-width: 300px; - } -`; +}; +//styles const GroupHeader = styled.div` - margin-top: 34px; - display: flex; - flex-direction: row; - width: 100%; - gap: 19px; + margin-top: 34px; + display: flex; + flex-direction: row; + width: 100%; + gap: 19px; `; const GroupDescription = styled.div` - margin-top: 34px; - display: flex; - flex-direction: column; - width: 100%; - align-items: flex-start; - gap: 5px; + margin-top: 34px; + display: flex; + flex-direction: column; + width: 100%; + align-items: flex-start; + gap: 5px; `; - const PublicEncrypted = styled.div` - margin-top: 20px; - display: flex; - flex-direction: row; - width: 100%; - gap: 19px; - align-items: center; - border: ${(props) => `1px solid ${props.theme.defaultBorder}`}; - border-radius: 16px; - padding: 16px; - box-sizing: border-box; -`; - -const GroupMembers = styled.div` - margin-top: 20px; - display: flex; - flex-direction: row; - width: 100%; - align-items: center; -`; - -const AdminItem = styled.div` - background: rgb(244, 220, 234); - color: rgb(213, 58, 148); - margin-left: auto; - font-size: 10px; - padding: 6px; - border-radius: 8px; + margin-top: 20px; + display: flex; + flex-direction: row; + width: 100%; + gap: 19px; + align-items: center; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + padding: 16px; + box-sizing: border-box; + background: ${(props) => props.theme.backgroundColor.modalHoverBackground}; `; const AddWalletContainer = styled.div` - margin-top: 20px; - border: ${(props) => `1px solid ${props.theme.defaultBorder}`}; - border-radius: 16px; - width: 100%; - padding: 20px 16px; - box-sizing: border-box; - display: flex; - flex-direction: row; - justify-content: center; - cursor: pointer; - align-items: center; + margin-top: 20px; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + width: 100%; + padding: 20px 16px; + box-sizing: border-box; + display: flex; + flex-direction: row; + justify-content: center; + cursor: pointer; + align-items: center; `; const GroupPendingMembers = styled.div` - margin-top: 3px; - display: flex; - flex-direction: row; - width: 100%; - align-items: center; - background: ${(props) => props.theme.pendingCardBackground}; - padding: 10px 15px; - box-sizing: border-box; - - &:last-child { - border-radius: 0px 0px 16px 16px; - } -`; + margin-top: 3px; + display: flex; + flex-direction: row; + width: 100%; + align-items: center; + background: ${(props) => props.theme.backgroundColor.modalHoverBackground}; + padding: 10px 15px; + box-sizing: border-box; + &:last-child { + border-radius: 0px 0px 16px 16px; + } +`; const PendingRequestWrapper = styled.div` - width: 100%; - margin-top: 20px; - border: ${(props) => `1px solid ${props.theme.defaultBorder}`}; - border-radius: 16px; - padding: 0px 0px; - box-sizing: border-box; + width: 100%; + margin-top: 20px; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + padding: 0px 0px; + box-sizing: border-box; `; const PendingSection = styled.div` - width: 100%; - display: flex; - flex-direction: row; - align-items: center; - flex: 1; - cursor: pointer; - padding: 15px 20px; - box-sizing: border-box; + width: 100%; + display: flex; + flex-direction: row; + align-items: center; + flex: 1; + cursor: pointer; + padding: 15px 20px; + box-sizing: border-box; `; const ArrowImage = styled(Image)<ShadowedProps>` - margin-left: auto; - transform: ${(props) => props?.setPosition ? 'rotate(0)' : 'rotate(180deg)'}; + margin-left: auto; + transform: ${(props) => + props?.setPosition ? 'rotate(0)' : 'rotate(180deg)'}; `; - const Badge = styled.div` - margin: 0 0 0 5px; - font-size: 13px; - background: rgb(207, 28, 132); - padding: 4px 8px; - border-radius: 7px; - color: white; - font-weight: 700; + margin: 0 0 0 5px; + font-size: 13px; + background: rgb(207, 28, 132); + padding: 4px 8px; + border-radius: 7px; + color: white; + font-weight: 700; `; + +const ConditionSection = styled(Section)<{ theme: IChatTheme }>` + &::-webkit-scrollbar-thumb { + background: ${(props) => props.theme.scrollbarColor}; + border-radius: 10px; + } + &::-webkit-scrollbar-button { + height: 20px; + } + &::-webkit-scrollbar { + width: 4px; + } +`; + +//auto update members when an user accepts not done diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/MemberListContainer.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/MemberListContainer.tsx index c92529fef..52885bec5 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/MemberListContainer.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/MemberListContainer.tsx @@ -1,183 +1,201 @@ -import { useContext, useRef, useState } from "react"; -import { ThemeContext } from "../theme/ThemeProvider"; -import { useClickAway } from "../../../hooks"; -import Dropdown, { DropdownValueType } from "./DropDown"; +import { useContext, useRef, useState } from 'react'; + +import styled from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { useClickAway } from '../../../hooks'; +import Dropdown, { DropdownValueType } from '../reusables/DropDown'; +import { Section, Span } from '../../reusables/sharedStyling'; + import DismissAdmin from '../../../icons/dismissadmin.svg'; import AddAdmin from '../../../icons/addadmin.svg'; import Remove from '../../../icons/remove.svg'; -import styled from "styled-components"; -import { Section, Image, Span } from "../../reusables/sharedStyling"; -import { MemberListContainerType, WalletProfileContainerProps } from "../exportedTypes"; -import { findObject } from "../helpers/helper"; -import { device } from "../../../config"; -import { shortenText } from "../../../helpers"; - -export const MemberListContainer = ({ key, memberData, handleMembers, handleMemberList, lightIcon, darkIcon, memberList }: MemberListContainerType) => { - const theme = useContext(ThemeContext); - const [selectedWallet, setSelectedWallet] = useState<string | null>(null); +import { IChatTheme, User } from '../exportedTypes'; +import { findObject } from '../helpers/helper'; +import { device } from '../../../config'; +import { shortenText } from '../../../helpers'; +import { ProfileContainer } from '../reusables'; + + +type MemberListContainerType = { + key?: number; + memberData: User; + handleMemberList: (member: User) => void; + handleMembers?: (value: User[]) => void; + darkIcon: any; + memberList?: any; +}; + +export interface WalletProfileContainerProps { + id?: any; + background?: any; + border?: string; +}; + +export const MemberListContainer = ({ + key, + memberData, + handleMembers, + handleMemberList, + darkIcon, + memberList, +}: MemberListContainerType) => { + const theme = useContext(ThemeContext); + const [selectedWallet, setSelectedWallet] = useState<string | null>(null); const [dropdownHeight, setDropdownHeight] = useState<number | undefined>(0); const dropdownRef = useRef<any>(null); - useClickAway(dropdownRef, () => setSelectedWallet(null)); - const removeAdminDropdown: DropdownValueType = - { id: 'dismiss_admin', title: 'Dismiss as admin', icon: DismissAdmin, function: () => dismissGroupAdmin() } + const removeAdminDropdown: DropdownValueType = { + id: 'dismiss_admin', + title: 'Dismiss as admin', + icon: DismissAdmin, + function: () => dismissGroupAdmin(), + }; - const addAdminDropdown: DropdownValueType = - { id: 'dismiss_admin', title: 'Make group admin', icon: AddAdmin, function: () => makeGroupAdmin() } + const addAdminDropdown: DropdownValueType = { + id: 'dismiss_admin', + title: 'Make group admin', + icon: AddAdmin, + function: () => makeGroupAdmin(), + }; - const removeUserDropdown: DropdownValueType = - { id: 'remove_user', title: 'Remove', icon: Remove, function: () => removeUser() } + const removeUserDropdown: DropdownValueType = { + id: 'remove_user', + title: 'Remove', + icon: Remove, + function: () => removeUser(), + }; const dismissGroupAdmin = () => { - const updatedMembers = memberList.map((member:any) => member?.wallets?.toLowerCase() == memberData?.wallets?.toLowerCase() ? ({ ...member, isAdmin: false }) : member) - handleMembers?.(updatedMembers) - setSelectedWallet(null) - } + const updatedMembers = memberList.map((member: any) => + member?.wallets?.toLowerCase() == memberData?.wallets?.toLowerCase() + ? { ...member, isAdmin: false } + : member + ); + handleMembers?.(updatedMembers); + setSelectedWallet(null); + }; const makeGroupAdmin = () => { - const updatedMembers = memberList.map((member: any) => member?.wallets?.toLowerCase() == memberData?.wallets?.toLowerCase() ? ({ ...member, isAdmin: true }) : member) - handleMembers?.(updatedMembers) - setSelectedWallet(null) - } + const updatedMembers = memberList.map((member: any) => + member?.wallets?.toLowerCase() == memberData?.wallets?.toLowerCase() + ? { ...member, isAdmin: true } + : member + ); + handleMembers?.(updatedMembers); + setSelectedWallet(null); + }; const removeUser = () => { - handleMemberList(memberData) - setSelectedWallet(null) - } - + handleMemberList(memberData); + setSelectedWallet(null); + }; const handleHeight = (id: any) => { - const containerHeight = document.getElementById(id)?.getBoundingClientRect(); + const containerHeight = document + .getElementById(id) + ?.getBoundingClientRect(); setDropdownHeight(containerHeight?.top); }; - - - return ( - <WalletProfileContainer id={memberData?.wallets} background = { memberList ? 'transparent' : theme.groupSearchProfilBackground } - border={memberList ? `${theme.modalBorderColor}`: 'none'} + return ( + <WalletProfileContainer + id={memberData?.wallets} + background={ + memberList ? 'transparent' : theme.backgroundColor?.modalHoverBackground + } + border={ + memberList ? theme.border?.modalInnerComponents:'none' + } + borderRadius={theme.borderRadius?.modalInnerComponents} > - <WalletProfile> - <Section - width="48px" - maxWidth="48px" - borderRadius="100%" - overflow="auto" - margin="0px 12px 0px 0px" - > - <Image src={memberData?.profilePicture ?? ''} height="48px" maxHeight="48px" width={'auto'} cursor='pointer' /> - </Section> - - <Span fontSize="18px" fontWeight="400" color={theme.modalPrimaryTextColor}>{shortenText(memberData?.wallets?.split(':')[1], 8, true)}</Span> - </WalletProfile> + <ProfileContainer + theme={theme} + member={{ + wallet: shortenText(memberData.wallets?.split(':')[1], 6, true), + image: memberData.profilePicture || '', + }} + /> - <Section justifyContent="flex-end"> + <Section justifyContent="flex-end"> {memberData?.isAdmin && ( - <Span - background="#F4DCEA" - color="#D53A94" - borderRadius="8px" - padding="6px" - fontWeight="500" - fontSize="10px" - > + <Span + background="#F4DCEA" + color="#D53A94" + borderRadius="8px" + padding="6px" + fontWeight="500" + fontSize="10px" + > Admin - </Span> + </Span> )} - <Section - maxWidth='fit-content' - onClick={() => { - handleHeight(memberData?.wallets); - setSelectedWallet(null) - memberList - ? findObject(memberData, memberList, 'wallets') - ? setSelectedWallet(memberData?.wallets) - : handleMemberList(memberData) - : handleMemberList(memberData) - }} - > - {/* {theme === 'light' ? lightIcon : darkIcon} */} - {darkIcon} - </Section> + <Section + maxWidth="fit-content" + onClick={() => { + handleHeight(memberData?.wallets); + setSelectedWallet(null); + memberList + ? findObject(memberData, memberList, 'wallets') + ? setSelectedWallet(memberData?.wallets) + : handleMemberList(memberData) + : handleMemberList(memberData); + }} + > + {darkIcon} + </Section> </Section> {selectedWallet?.toLowerCase() == memberData?.wallets?.toLowerCase() && ( - <DropdownContainer style={{ top: dropdownHeight! > 500 ? '30%' : "45%" }} ref={dropdownRef} theme={theme}> + <DropdownContainer + style={{ top: dropdownHeight! > 500 ? '30%' : '45%' }} + ref={dropdownRef} + theme={theme} + > <Dropdown - dropdownValues={memberData?.isAdmin ? [removeAdminDropdown,removeUserDropdown] : [addAdminDropdown, removeUserDropdown]} - hoverBGColor={theme.snapFocusBg} + dropdownValues={ + memberData?.isAdmin + ? [removeAdminDropdown, removeUserDropdown] + : [addAdminDropdown, removeUserDropdown] + } + hoverBGColor={theme.backgroundColor?.modalHoverBackground} /> </DropdownContainer> )} - - </ WalletProfileContainer> - ) -} - + </WalletProfileContainer> + ); +}; const WalletProfileContainer = styled(Section)<WalletProfileContainerProps>` - // position: relative; - // padding: 5px 16px; - // margin: 8px 0px; - // justify-content: space-between; - // // min-width: 450px; - // min-width: 100%; - // box-sizing: border-box; - // align-items: center; - // border-radius: 16px; - - // @media (max-width: 480px) { - // // min-width: 300px; - // } - - justify-content: space-between; - padding: 8px 16px; - border-radius: 16px; - position: relative; - box-sizing: border-box; - width: 100%; - // background-color: ${(props) => props.theme.snapFocusBg}; - max-height: 64px; - align-self: stretch; - display: flex; - height: auto; - z-index: auto; - flex: 1; - @media (max-width: 480px) { - max-width: 100%; - } - -`; - -const WalletProfile = styled(Section)` - justify-content: flex-start; + justify-content: space-between; + padding: 8px 16px; + border: ${(props) => props.border}; + position: relative; + box-sizing: border-box; + width: 100%; + max-height: 64px; + align-self: stretch; + display: flex; + height: auto; + z-index: auto; + flex: 1; + @media (max-width: 480px) { + max-width: 100%; + } `; const DropdownContainer = styled.div` - // position: absolute; - // left: 48%; - // border-radius: 16px; - // padding: 14px 8px; - // background: ${(props) => props.theme.modalContentBackground}; - // border: 1px solid ${(props) => props.theme.modalBorderColor}; - // z-index: 400; - // @media ${device.mobileL} { - // left: 27%; - // } - // @media (min-width: 426px) and (max-width: 1150px) { - // left: 47%; - // } position: absolute; left: 48%; top: 69%; - border-radius: 16px; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; padding: 14px 8px; z-index: 999999999999 !important; display: flex; flex-direction: column !important; - background: ${(props) => props.theme.modalContentBackground}; - border: 1px solid ${(props) => props.theme.modalBorderColor}; + background: ${(props) => props.theme.backgroundColor.modalBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; @media ${device.mobileL} { left: 27%; @@ -185,7 +203,7 @@ const DropdownContainer = styled.div` @media (min-width: 426px) and (max-width: 1150px) { left: 48%; } - @media (max-width: 480px){ + @media (max-width: 480px) { left: 25%; } -`; \ No newline at end of file +`; diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/MemberProfileCard.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/MemberProfileCard.tsx new file mode 100644 index 000000000..80b6bfa9f --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/ChatProfile/MemberProfileCard.tsx @@ -0,0 +1,154 @@ +// React + Web3 Essentials +import React, { useContext, useState } from 'react'; + +// External Packages +import styled from 'styled-components'; + +// Internal Components +import { MoreLightIcon } from '../../../icons/MoreLight'; +import { shortenText } from '../../../helpers'; +import { ThemeContext } from '../theme/ThemeProvider'; +import { useChatData } from '../../../hooks'; +import { Section, Span } from '../../reusables'; +import Dropdown from '../reusables/DropDown'; +import { pCAIP10ToWallet } from '../../../helpers'; +import { device } from '../../../config'; +import { IChatTheme } from '../theme'; +import { ProfileContainer } from '../reusables'; + +type MemberProfileCardProps = { + key?: number | string; + member?: any; + dropdownValues?: any; + selectedMemberAddress?: any; + setSelectedMemberAddress?: any; + dropdownRef?: any; +}; + + +export const MemberProfileCard = ({ + key, + member, + dropdownValues, + selectedMemberAddress, + setSelectedMemberAddress, + dropdownRef, +}: MemberProfileCardProps) => { + const theme = useContext(ThemeContext); + const { account } = useChatData(); + + const [dropdownHeight, setDropdownHeight] = useState<number | undefined>(0); + + const handleHeight = (id: any) => { + const containerHeight = document + .getElementById(id) + ?.getBoundingClientRect(); + setDropdownHeight(containerHeight?.top); + }; + + + return ( + <ProfileCardItem + background={ + (member.wallet?.toLowerCase() === selectedMemberAddress?.toLowerCase()) ? theme.backgroundColor?.modalHoverBackground : '' + } + id={member.wallet} + key={key} + theme={theme} + > + <ProfileContainer + theme={theme} + member={{ + wallet: shortenText(member?.wallet?.split(':')[1], 6, true), + image: member.image, + }} + /> + <Section justifyContent="flex-end" position="relative" zIndex="2"> + {member?.isAdmin && ( + <Span + background="#F4DCEA" + color="#D53A94" + borderRadius="8px" + padding="6px" + fontWeight="500" + fontSize="10px" + > + Admin + </Span> + )} + {pCAIP10ToWallet(member?.wallet)?.toLowerCase() !== + account?.toLowerCase() && + dropdownValues.length > 0 && ( + <Section + maxWidth="fit-content" + padding="0 0px 0 0" + position="relative" + zIndex="2" + onClick={() => { + handleHeight(member.wallet); + setSelectedMemberAddress(member?.wallet); + }} + style={{ cursor: 'pointer' }} + > + <MoreLightIcon fill={theme.iconColor?.groupSettings} /> + </Section> + )} + </Section> + {selectedMemberAddress?.toLowerCase() == + member?.wallet?.toLowerCase() && ( + <DropdownContainer + style={{ top: dropdownHeight! > 570 ? '30%' : '40%' }} + theme={theme} + ref={dropdownRef} + > + <Dropdown + dropdownValues={dropdownValues} + hoverBGColor={theme.backgroundColor?.modalHoverBackground} + /> + </DropdownContainer> + )} + </ProfileCardItem> + ); +}; + +//styles +const ProfileCardItem = styled(Section)<{ id: any; key: any; background: any }>` + justify-content: space-between; + padding: 8px 8px; + border-radius: 16px; + position: relative; + box-sizing: border-box; + width: 100%; + max-height: 64px; + align-self: stretch; + display: flex; + height: auto; + z-index: auto; + flex: 1; + @media (max-width: 480px) { + max-width: 100%; + } +`; + +const DropdownContainer = styled(Section)` + position: absolute; + left: 48%; + top: 69%; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + padding: 14px 8px; + z-index: 999999999999 !important; + display: flex; + flex-direction: column !important; + background: ${(props) => props.theme.backgroundColor.modalBackground}; + border: ${(props) => props.theme.border.modal}; + + @media ${device.mobileL} { + left: 27%; + } + @media (min-width: 426px) and (max-width: 1150px) { + left: 48%; + } + @media (max-width: 480px) { + left: 25%; + } +`; diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/ProfileCard.tsx b/packages/uiweb/src/lib/components/chat/ChatProfile/ProfileCard.tsx deleted file mode 100644 index 2ee09770f..000000000 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/ProfileCard.tsx +++ /dev/null @@ -1,158 +0,0 @@ -// React + Web3 Essentials -import React, { useContext ,useState } from 'react'; - -// External Packages -import styled from 'styled-components'; -import { ethers } from 'ethers'; - -// Internal Components -import { MoreLightIcon } from '../../../icons/MoreLight'; -import { MoreDarkIcon } from '../../../icons/MoreDark'; -import { shortenText } from "../../../helpers"; -import { ThemeContext } from "../theme/ThemeProvider"; -import { useChatData, useClickAway} from "../../../hooks"; -import { Image, Section, Span } from "../../reusables"; -import Dropdown from './DropDown'; -import { pCAIP10ToWallet } from '../../../helpers'; -import { device } from "../../../config"; - - -type ProfileCardProps = { - key?: number | string, - member?: any, - dropdownValues?: any; - selectedMemberAddress?: any; - setSelectedMemberAddress?: any; - dropdownRef?: any; -} - -export const ProfileCard = ({ - key, - member, - dropdownValues, - selectedMemberAddress, - setSelectedMemberAddress, - dropdownRef, -}: ProfileCardProps) => { - const theme = useContext(ThemeContext); - const { account } = useChatData(); - - const [dropdownHeight, setDropdownHeight] = useState<number | undefined>(0); - - const handleHeight = (id: any) => { - const containerHeight = document.getElementById(id)?.getBoundingClientRect(); - setDropdownHeight(containerHeight?.top); - }; - - return ( - <ProfileCardItem background={member.wallet === selectedMemberAddress ? theme.snapFocusBg : ''} id={member.wallet} key={key} theme={theme}> - <Section justifyContent="flex-start" position='relative' zIndex='2'> - <Section - height="48px" - maxWidth="48px" - borderRadius="100%" - overflow="hidden" - margin="0px 12px 0px 0px" - position='relative' - zIndex='2' - > - <Image - height="48px" maxHeight="48px" width={'auto'} cursor='pointer' - src={member?.image} - /> - </Section> - <Span - fontSize="18px" - fontWeight="400" - color={theme.modalProfileTextColor} - position='relative' - zIndex='2' - > - {shortenText(member?.wallet?.split(':')[1], 6, true)} - </Span> - </Section> - <Section justifyContent="flex-end" position='relative' zIndex='2'> - {member?.isAdmin && ( - <Span - background="#F4DCEA" - color="#D53A94" - borderRadius="8px" - padding="6px" - fontWeight="500" - fontSize="10px" - > - Admin - </Span> - )} - {pCAIP10ToWallet(member?.wallet)?.toLowerCase() !== account?.toLowerCase() && dropdownValues.length > 0 && ( - <Section - maxWidth="fit-content" - padding="0 0px 0 0" - position='relative' - zIndex='2' - onClick={() => { - handleHeight(member.wallet); - setSelectedMemberAddress(member?.wallet) - }} - style={{ cursor: 'pointer' }} - > - {theme ? <MoreLightIcon /> : <MoreDarkIcon />} - </Section> - )} - </Section> - {selectedMemberAddress?.toLowerCase() == member?.wallet?.toLowerCase() && ( - <DropdownContainer - style={{ top: dropdownHeight! > 570 ? '30%' : '40%' }} - theme={theme} - ref={dropdownRef}> - <Dropdown - dropdownValues={dropdownValues} - hoverBGColor={theme.snapFocusBg} - /> - </DropdownContainer> - )} - </ProfileCardItem> - ); -}; - -const ProfileCardItem = styled(Section)<{id: any, key: any, background: any}>` - justify-content: space-between; - padding: 8px 16px; - border-radius: 16px; - position: relative; - box-sizing: border-box; - width: 100%; - // background-color: ${(props) => props.theme.snapFocusBg}; - max-height: 64px; - align-self: stretch; - display: flex; - height: auto; - z-index: auto; - flex: 1; - @media (max-width: 480px) { - max-width: 100%; - } -`; - -const DropdownContainer = styled(Section)` - position: absolute; - left: 48%; - top: 69%; - border-radius: 16px; - padding: 14px 8px; - z-index: 999999999999 !important; - display: flex; - flex-direction: column !important; - background: ${(props) => props.theme.modalContentBackground}; - border: 1px solid ${(props) => props.theme.modalBorderColor}; - - @media ${device.mobileL} { - left: 27%; - } - @media (min-width: 426px) and (max-width: 1150px) { - left: 48%; - } - @media (max-width: 480px){ - left: 25%; - } -`; diff --git a/packages/uiweb/src/lib/components/chat/ChatViewBubble/ChatViewBubble.tsx b/packages/uiweb/src/lib/components/chat/ChatViewBubble/ChatViewBubble.tsx index 9ad6ce257..1b388c4ed 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewBubble/ChatViewBubble.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewBubble/ChatViewBubble.tsx @@ -1,320 +1,388 @@ -import { useContext, useEffect, useState } from "react"; -import { Section, Span, Image } from "../../reusables"; -import moment from "moment"; -import styled from "styled-components"; -import { FileMessageContent } from "../../../types"; -import { FILE_ICON } from "../../../config"; -import { formatFileSize, getPfp, pCAIP10ToWallet, setPfp, shortenText } from "../../../helpers"; -import { checkTwitterUrl } from "../helpers/twitter"; -import { IMessagePayload, TwitterFeedReturnType } from "../exportedTypes"; -import { TwitterTweetEmbed } from "react-twitter-embed"; -import { ChatDataContext } from "../../../context"; -import { useChatData } from "../../../hooks"; -import { ThemeContext } from "../theme/ThemeProvider"; +import { + ReactElement, + ReactNode, + useContext, + useEffect, + useState, +} from 'react'; + +import moment from 'moment'; +import styled from 'styled-components'; +import { TwitterTweetEmbed } from 'react-twitter-embed'; + +import { Section, Span, Image } from '../../reusables'; +import { checkTwitterUrl } from '../helpers/twitter'; +import { ChatDataContext } from '../../../context'; +import { useChatData } from '../../../hooks'; +import { ThemeContext } from '../theme/ThemeProvider'; + +import { FileMessageContent } from '../../../types'; +import { IMessagePayload, TwitterFeedReturnType } from '../exportedTypes'; +import { FILE_ICON } from '../../../config'; +import { + formatFileSize, + getPfp, + pCAIP10ToWallet, + shortenText, +} from '../../../helpers'; const SenderMessageAddress = ({ chat }: { chat: IMessagePayload }) => { - const { account } = useContext(ChatDataContext) - const theme = useContext(ThemeContext) - return ( - <> - {chat.fromCAIP10.split(":")[1] !== account && ( - <Span theme={theme} alignSelf="start" - textAlign="start" color={theme.textColorPrimary}>{chat.fromDID.split(":")[1].slice(0, 6)}... - {chat.fromDID.split(":")[1].slice(-6)}</Span> - )} - </> - ) -} + const { account } = useContext(ChatDataContext); + const theme = useContext(ThemeContext); + return ( + <> + {chat.fromCAIP10.split(':')[1] !== account && ( + <Span + theme={theme} + alignSelf="start" + textAlign="start" + fontSize={theme.fontSize?.chatReceivedBubbleAddressText} + fontWeight={theme.fontWeight?.chatReceivedBubbleAddressText} + color={theme.textColor?.chatReceivedBubbleAddressText} + > + {chat.fromDID.split(':')[1].slice(0, 6)}... + {chat.fromDID.split(':')[1].slice(-6)} + </Span> + )} + </> + ); +}; -const SenderMessafeProfilePicture = ({ chat }: { chat: IMessagePayload }) => { - const { account, env } = useContext(ChatDataContext) - const [pfp, setPfp] = useState<string>("") - const getUserPfp = async () => { - const pfp = await getPfp({ account: chat.fromCAIP10.split(":")[1], env: env }) - if (pfp) { - setPfp(pfp) - } +const SenderMessageProfilePicture = ({ chat }: { chat: IMessagePayload }) => { + const { account, env } = useContext(ChatDataContext); + const [pfp, setPfp] = useState<string>(''); + const getUserPfp = async () => { + const pfp = await getPfp({ + account: chat.fromCAIP10.split(':')[1], + env: env, + }); + if (pfp) { + setPfp(pfp); } - useEffect(() => { - getUserPfp() - }, [account, chat.fromCAIP10]) - return ( - <Section justifyContent="start" alignItems="start"> - {chat.fromCAIP10.split(":")[1] !== account && ( - <Section alignItems="start"> - {pfp && <Image src={pfp} alt="profile picture" width="40px" height="40px" borderRadius="50%" />} - </Section> - )} + }; + useEffect(() => { + getUserPfp(); + }, [account, chat.fromCAIP10]); + return ( + <Section justifyContent="start" alignItems="start"> + {chat.fromCAIP10.split(':')[1] !== account && ( + <Section alignItems="start"> + {pfp && ( + <Image + src={pfp} + alt="profile picture" + width="40px" + height="40px" + borderRadius="50%" + /> + )} </Section> - ) -} + )} + </Section> + ); +}; + +const MessageWrapper = ({ + chat, + children, + isGroup, + maxWidth, +}: { + chat: IMessagePayload; + children: ReactNode; + isGroup: boolean; + maxWidth?: string; +}) => { + const theme = useContext(ThemeContext); + return ( + <Section + theme={theme} + flexDirection="row" + justifyContent="start" + gap="6px" + width="fit-content" + maxWidth={maxWidth || 'auto'} + > + {isGroup && <SenderMessageProfilePicture chat={chat} />} + <Section justifyContent="start" flexDirection="column"> + {isGroup && <SenderMessageAddress chat={chat} />} + {children} + </Section> + + </Section> + ); +}; const MessageCard = ({ - chat, - position, - isGroup, + chat, + position, + isGroup, }: { - chat: IMessagePayload; - position: number; - isGroup: boolean; + chat: IMessagePayload; + position: number; + isGroup: boolean; }) => { - const theme = useContext(ThemeContext) - const time = moment(chat.timestamp).format('hh:mm a'); - return ( - <Section theme={theme} flexDirection="row" justifyContent="start" gap="6px" width="fit-content"> - {isGroup && - <SenderMessafeProfilePicture chat={chat} /> - } - <Section justifyContent="start" flexDirection="column" + const theme = useContext(ThemeContext); + const time = moment(chat.timestamp).format('hh:mm a'); + return ( + <MessageWrapper chat={chat} isGroup={isGroup} maxWidth="70%"> + <Section + gap="5px" + background={ + position + ? `${theme.backgroundColor?.chatSentBubbleBackground}` + : `${theme.backgroundColor?.chatReceivedBubbleBackground}` + } + padding="8px 12px" + borderRadius={position ? '12px 0px 12px 12px' : '0px 12px 12px 12px'} + margin="5px 0" + alignSelf={position ? 'end' : 'start'} + justifyContent="start" + minWidth="71px" + position="relative" + width="fit-content" + color={ + position + ? `${theme.textColor?.chatSentBubbleText}` + : `${theme.textColor?.chatReceivedBubbleText}` + } + > + {' '} + <Section flexDirection="column" padding="5px 0 15px 0"> + {chat.messageContent.split('\n').map((str) => ( + <Span + key={Math.random().toString()} + alignSelf="start" + textAlign="left" + fontSize={ + position + ? `${theme.fontSize?.chatSentBubbleText}` + : `${theme.fontSize?.chatReceivedBubbleText}` + } + fontWeight={ + position + ? `${theme.fontWeight?.chatSentBubbleText}` + : `${theme.fontWeight?.chatReceivedBubbleText}` + } + color={ + position + ? `${theme.textColor?.chatSentBubbleText}` + : `${theme.textColor?.chatReceivedBubbleText}` + } > - {isGroup && - <SenderMessageAddress chat={chat} /> - } - <Section - gap="5px" - background={position ? `${theme.chatBubbleAccentBgColor}` : `${theme.chatBubblePrimaryBgColor}`} - padding="8px 12px" - borderRadius={position ? '12px 0px 12px 12px' : '0px 12px 12px 12px'} - margin="5px 0" - alignSelf={position ? 'end' : 'start'} - justifyContent="start" - maxWidth="80%" - minWidth="71px" - position="relative" - width="fit-content" - color={position ? `${theme.accentTextColor}` : `${theme.textColorPrimary}`} - > - {' '} - <Section flexDirection="column" padding="5px 0 15px 0"> - {chat.messageContent.split('\n').map((str) => ( - <Span - key={Math.random().toString()} - alignSelf="start" - textAlign="left" - fontSize="16px" - fontWeight="400" - color={position ? '#fff' : '#000'} - > - {str} - </Span> - ))} - </Section> - <Span - position="absolute" - fontSize="12px" - fontWeight="400" - color={position ? `${theme.accentTextColor}` : '#62626A'} - bottom="6px" - right="10px" - > - {time} - </Span> - </Section> - </Section> + {str} + </Span> + ))} </Section> - ); + <Span + position="absolute" + fontSize={ + position + ? `${theme.fontSize?.chatSentBubbleTimestampText}` + : `${theme.fontSize?.chatReceivedBubbleTimestampText}` + } + fontWeight={ + position + ? `${theme.fontWeight?.chatSentBubbleTimestampText}` + : `${theme.fontWeight?.chatReceivedBubbleTimestampText}` + } + color={ + position + ? `${theme.textColor?.chatSentBubbleText}` + : `${theme.textColor?.chatReceivedBubbleText}` + } + bottom="6px" + right="10px" + > + {time} + </Span> + </Section> + </MessageWrapper> + ); }; const FileCard = ({ - chat, - isGroup, + chat, + isGroup, }: { - chat: IMessagePayload; - position: number; - isGroup: boolean; + chat: IMessagePayload; + position: number; + isGroup: boolean; }) => { - const fileContent: FileMessageContent = JSON.parse(chat.messageContent); - const name = fileContent.name; + const fileContent: FileMessageContent = JSON.parse(chat.messageContent); + const name = fileContent.name; - const content = fileContent.content as string; - const size = fileContent.size; + const content = fileContent.content as string; + const size = fileContent.size; - return ( - <Section flexDirection="row" justifyContent="start" gap="6px" width="fit-content"> - {isGroup && - <SenderMessafeProfilePicture chat={chat} /> - } - <Section flexDirection="column"> - {isGroup && - <SenderMessageAddress chat={chat} /> - } - <Section - alignSelf="start" - maxWidth="100%" - margin="5px 0" - background="#343536" - borderRadius="8px" - justifyContent="space-around" - padding="10px 13px" - gap="15px" - width="fit-content" - > - <Image - src={FILE_ICON(name.split('.').slice(-1)[0])} - alt="extension icon" - width="20px" - height="20px" - /> - <Section flexDirection="column" gap="5px"> - <Span color="#fff" fontSize="15px"> - {shortenText(name, 11)} - </Span> - <Span color="#fff" fontSize="12px"> - {formatFileSize(size)} - </Span> - </Section> - <FileDownloadIconAnchor - href={content} - target="_blank" - rel="noopener noreferrer" - download - > - <FileDownloadIcon className="fa fa-download" aria-hidden="true" /> - </FileDownloadIconAnchor> - </Section> - </Section> + return ( + <MessageWrapper maxWidth="fit-content" chat={chat} isGroup={isGroup}> + <Section + alignSelf="start" + maxWidth="100%" + margin="5px 0" + background="#343536" + borderRadius="8px" + justifyContent="space-around" + padding="10px 13px" + gap="15px" + width="fit-content" + > + <Image + src={FILE_ICON(name.split('.').slice(-1)[0])} + alt="extension icon" + width="20px" + height="20px" + /> + <Section flexDirection="column" gap="5px"> + <Span color="#fff" fontSize="15px"> + {shortenText(name, 11)} + </Span> + <Span color="#fff" fontSize="12px"> + {formatFileSize(size)} + </Span> </Section> - ); + <FileDownloadIconAnchor + href={content} + target="_blank" + rel="noopener noreferrer" + download + > + <FileDownloadIcon className="fa fa-download" aria-hidden="true" /> + </FileDownloadIconAnchor> + </Section> + </MessageWrapper> + ); }; const ImageCard = ({ - chat, - position, - isGroup, + chat, + position, + isGroup, }: { - chat: IMessagePayload; - position: number; - isGroup: boolean; + chat: IMessagePayload; + position: number; + isGroup: boolean; }) => { - - return ( - <Section flexDirection="row" justifyContent="start" gap="6px"> - {isGroup && - <SenderMessafeProfilePicture chat={chat} /> - } - <Section justifyContent="start" flexDirection="column"> - {isGroup && ( - <SenderMessageAddress chat={chat} /> - )} - <Section - alignSelf={position ? 'end' : 'start'} - maxWidth="65%" - width="fit-content" - margin="5px 0" - > - <Image - src={JSON.parse(chat.messageContent).content} - alt="" - width="100%" - borderRadius={position ? '12px 0px 12px 12px' : '0px 12px 12px 12px'} - /> - </Section> - </Section> - </Section> - ); + return ( + <MessageWrapper chat={chat} isGroup={isGroup}> + <Section + alignSelf={position ? 'end' : 'start'} + maxWidth="65%" + width="fit-content" + margin="5px 0" + > + <Image + src={JSON.parse(chat.messageContent).content} + alt="" + width="100%" + borderRadius={position ? '12px 0px 12px 12px' : '0px 12px 12px 12px'} + /> + </Section> + </MessageWrapper> + ); }; const GIFCard = ({ - chat, - position, - isGroup, + chat, + position, + isGroup, }: { - chat: IMessagePayload; - position: number; - isGroup: boolean; + chat: IMessagePayload; + position: number; + isGroup: boolean; }) => { - return ( - <Section flexDirection="row" justifyContent="start" gap="6px" width="fit-content"> - {isGroup && - <SenderMessafeProfilePicture chat={chat} /> - } - <Section justifyContent="start" flexDirection="column"> - {isGroup && - <SenderMessageAddress chat={chat} /> - } - <Section - alignSelf={position ? 'end' : 'start'} - maxWidth="65%" - margin="5px 0" - width="fit-content" - > - <Image - src={chat.messageContent} - alt="" - width="100%" - borderRadius={position ? '12px 0px 12px 12px' : '0px 12px 12px 12px'} - /> - </Section> - </Section> - </Section> - ); + return ( + <MessageWrapper chat={chat} isGroup={isGroup} maxWidth="fit-content"> + <Section + alignSelf={position ? 'end' : 'start'} + maxWidth="65%" + margin="5px 0" + width="fit-content" + > + <Image + src={chat.messageContent} + alt="" + width="100%" + borderRadius={position ? '12px 0px 12px 12px' : '0px 12px 12px 12px'} + /> + </Section> + </MessageWrapper> + ); }; -const TwitterCard = ({ chat, tweetId, isGroup, position }: { chat: IMessagePayload, tweetId: string, isGroup: boolean, position: number }) => { - return ( - <Section flexDirection="row" justifyContent="start" gap="6px" width="fit-content"> - {isGroup && - <SenderMessafeProfilePicture chat={chat} /> - } - <Section justifyContent="start" flexDirection="column"> - {isGroup && - <SenderMessageAddress chat={chat} /> - } - <Section - alignSelf={position ? 'end' : 'start'} - maxWidth="100%" - width="fit-content" - margin="5px 0" - > - <TwitterTweetEmbed tweetId={tweetId} /> - </Section> - </Section> - </Section> - ) -} +const TwitterCard = ({ + chat, + tweetId, + isGroup, + position, +}: { + chat: IMessagePayload; + tweetId: string; + isGroup: boolean; + position: number; +}) => { + return ( + <MessageWrapper chat={chat} isGroup={isGroup} maxWidth="fit-content"> + <Section + alignSelf={position ? 'end' : 'start'} + maxWidth="100%" + width="fit-content" + margin="5px 0" + > + <TwitterTweetEmbed tweetId={tweetId} /> + </Section> + </MessageWrapper> + ); +}; export const ChatViewBubble = ({ chat }: { chat: IMessagePayload }) => { - const { account, setAccount, pgpPrivateKey, setPgpPrivateKey, env, setEnv } = useChatData(); - const position = pCAIP10ToWallet(chat.fromDID).toLowerCase() !== account?.toLowerCase() ? 0 : 1; - const { tweetId, messageType }: TwitterFeedReturnType = checkTwitterUrl({ message: chat?.messageContent }); - const [isGroup, setIsGroup] = useState<boolean>(false); - useEffect(() => { - if (chat.toDID.split(':')[0] === 'eip155') { - if (isGroup) { - setIsGroup(false); - } - } else { - if (!isGroup) { - setIsGroup(true); - } - } - }, [chat.toDID, isGroup]) - - // useEffect(() => { - // setAccount(""); - // setPgpPrivateKey(""); - // setEnv(env); - // }, [account, env, pgpPrivateKey]) - - if (messageType === 'TwitterFeedLink') { - chat.messageType = 'TwitterFeedLink'; + const { account } = useChatData(); + const position = + pCAIP10ToWallet(chat.fromDID).toLowerCase() !== account?.toLowerCase() + ? 0 + : 1; + const { tweetId, messageType }: TwitterFeedReturnType = checkTwitterUrl({ + message: chat?.messageContent, + }); + const [isGroup, setIsGroup] = useState<boolean>(false); + useEffect(() => { + if (chat.toDID.split(':')[0] === 'eip155') { + if (isGroup) { + setIsGroup(false); + } + } else { + if (!isGroup) { + setIsGroup(true); + } } + }, [chat.toDID, isGroup]); - if (chat.messageType === 'GIF') { - return <GIFCard isGroup={isGroup} chat={chat} position={position} /> - } - if (chat.messageType === 'Image') { - return <ImageCard isGroup={isGroup} chat={chat} position={position} />; - } - if (chat.messageType === 'File') { - return <FileCard isGroup={isGroup} chat={chat} position={position} />; - } - if (chat.messageType === 'TwitterFeedLink') { - return <TwitterCard tweetId={tweetId} isGroup={isGroup} chat={chat} position={position} />; - } - return <MessageCard isGroup={isGroup} chat={chat} position={position} />; -} + if (messageType === 'TwitterFeedLink') { + chat.messageType = 'TwitterFeedLink'; + } + if (chat.messageType === 'GIF') { + return <GIFCard isGroup={isGroup} chat={chat} position={position} />; + } + if (chat.messageType === 'Image') { + return <ImageCard isGroup={isGroup} chat={chat} position={position} />; + } + if (chat.messageType === 'File') { + return <FileCard isGroup={isGroup} chat={chat} position={position} />; + } + if (chat.messageType === 'TwitterFeedLink') { + return ( + <TwitterCard + tweetId={tweetId} + isGroup={isGroup} + chat={chat} + position={position} + /> + ); + } + return <MessageCard isGroup={isGroup} chat={chat} position={position} />; +}; const FileDownloadIcon = styled.i` color: #575757; @@ -322,4 +390,4 @@ const FileDownloadIcon = styled.i` const FileDownloadIconAnchor = styled.a` font-size: 20px; -`; \ No newline at end of file +`; diff --git a/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx b/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx index 846112317..9cd16d4da 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewComponent/ChatViewComponent.tsx @@ -1,22 +1,31 @@ -import React, { useContext} from 'react'; -import { IChatViewComponentProps } from '../exportedTypes'; +import React, { useContext } from 'react'; +import { IChatTheme, IChatViewComponentProps } from '../exportedTypes'; -import { Section, } from '../../reusables'; +import { Section, Span } from '../../reusables'; import { ChatViewList } from '../ChatViewList'; -import { chatLimit } from '../../../config'; +import { chatLimit, device } from '../../../config'; import { ThemeContext } from '../theme/ThemeProvider'; import { useChatData } from '../../../hooks/chat/useChatData'; import { MessageInput } from '../MessageInput'; import { ChatProfile } from '../ChatProfile'; +import styled from 'styled-components'; +import useMediaQuery from '../../../hooks/useMediaQuery'; - +/** + * @interface IThemeProps + * this interface is used for defining the props for styled components + */ +interface IThemeProps { + theme?: IChatTheme; +} export const ChatViewComponent: React.FC<IChatViewComponentProps> = ( options: IChatViewComponentProps ) => { const { chatId, + chatFilterList = [], messageInput = true, chatViewList = true, chatProfile = true, @@ -25,62 +34,77 @@ export const ChatViewComponent: React.FC<IChatViewComponentProps> = ( file = true, gif = true, isConnected = true, + autoConnect = false, + onGetTokenClick, } = options || {}; - const {env } = useChatData(); + const { env, signer, account, pgpPrivateKey } = useChatData(); - console.log(env); - // const [conversationHash, setConversationHash] = useState<string>(); const theme = useContext(ThemeContext); - - - - - - - - + const isMobile = useMediaQuery(device.mobileL); return ( - <Section + <Conatiner width="100%" height="inherit" flexDirection="column" justifyContent="space-between" overflow="hidden" - background={theme.bgColorSecondary} - borderRadius={theme.borderRadius} + background={theme.backgroundColor?.chatViewComponentBackground} + borderRadius={theme.borderRadius?.chatViewComponent} padding="13px" + theme={theme} > - - {chatProfile && <ChatProfile chatId={chatId} style="Info" />} + {chatProfile && <ChatProfile chatId={chatId} style="Info" />} <Section flex="1 1 auto" overflow="hidden" - padding="0 20px" + padding={isMobile ? '0 10px' : '0 20px'} margin="0 0px 10px 0px" flexDirection="column" justifyContent="start" > - - - {chatId && chatViewList && <ChatViewList limit={limit} chatId={chatId} />} - + {chatId && chatViewList && ( + <ChatViewList + chatFilterList={chatFilterList} + limit={limit} + chatId={chatId} + /> + )} </Section> - {/* )} */} - - {messageInput && ( + {(!signer && !(!!account && !!pgpPrivateKey) && !isConnected) && ( + <Section flex="0 1 auto"> + <Span> + You need to either pass signer or isConnected to send + messages{' '} + </Span> + </Section> + )} + {(messageInput && (!!signer || (!!account && !!pgpPrivateKey) || isConnected )) && ( <Section flex="0 1 auto"> - <MessageInput chatId={chatId} File={file} Emoji={emoji} GIF={gif} isConnected={isConnected} /> + <MessageInput + onGetTokenClick={onGetTokenClick} + chatId={chatId} + file={file} + emoji={emoji} + gif={gif} + isConnected={isConnected} + autoConnect = {autoConnect} + /> </Section> )} - </Section> + + </Conatiner> ); }; //styles - +const Conatiner = styled(Section)<IThemeProps>` + border: ${(props) => props.theme.border?.chatViewComponent}; + backdrop-filter: ${(props) => props.theme.backdropFilter}; + box-sizing: border-box; +`; diff --git a/packages/uiweb/src/lib/components/chat/ChatViewList/ApproveRequestBubble.tsx b/packages/uiweb/src/lib/components/chat/ChatViewList/ApproveRequestBubble.tsx index afdc1724a..6df0a560b 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewList/ApproveRequestBubble.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewList/ApproveRequestBubble.tsx @@ -1,10 +1,9 @@ import { IFeeds } from '@pushprotocol/restapi'; import { ThemeContext } from '../theme/ThemeProvider'; import { Dispatch, useContext } from 'react'; -import { Div, Section, Span, Spinner } from '../../reusables'; +import { Section, Span, Spinner } from '../../reusables'; import useApproveChatRequest from '../../../hooks/chat/useApproveChatRequest'; import { useChatData } from '../../../hooks'; -import { TickSvg } from '../../../icons/Tick'; import styled from 'styled-components'; import { IChatTheme } from '../theme'; @@ -21,17 +20,19 @@ export interface IApproveRequestBubbleProps { setChatFeed: Dispatch<IFeeds>; } + export const ApproveRequestBubble = ({ chatFeed, chatId, setChatFeed, }: IApproveRequestBubbleProps) => { - const { account, pgpPrivateKey, env } = useChatData(); + const { pgpPrivateKey } = useChatData(); const ApproveRequestText = { GROUP: `You were invited to the group ${chatFeed?.groupInformation?.groupName}. Please accept to continue messaging in this group.`, W2W: ` Please accept to enable push chat from this wallet`, }; + const theme = useContext(ThemeContext); const { approveChatRequest, loading: approveLoading } = useApproveChatRequest(); @@ -41,6 +42,7 @@ export const ApproveRequestBubble = ({ if (!pgpPrivateKey) { return; } + const response = await approveChatRequest({ chatId, }); @@ -56,9 +58,9 @@ export const ApproveRequestBubble = ({ }; return ( <Section - color={theme.textColorPrimary} + color={theme.textColor?.chatReceivedBubbleText} gap="10px" - background={theme.chatBubblePrimaryBgColor} + background={theme.backgroundColor?.chatReceivedBubbleBackground} padding="8px 12px" margin="7px 0" borderRadius=" 0px 12px 12px 12px" @@ -72,9 +74,9 @@ export const ApproveRequestBubble = ({ <Span alignSelf="center" textAlign="left" - fontSize="16px" - fontWeight="400" - color="#000" + fontSize={theme.fontSize?.chatReceivedBubbleText} + fontWeight={theme.fontWeight?.chatReceivedBubbleText} + color={theme.textColor?.chatReceivedBubbleText} lineHeight="24px" > {chatFeed?.groupInformation @@ -87,13 +89,7 @@ export const ApproveRequestBubble = ({ > {approveLoading ? <Spinner color="#fff" size="24" /> : 'Accept'} </Button> - {/* <Div - width="auto" - cursor="pointer" - onClick={() => (!approveLoading ? handleApproveChatRequest() : null)} - > - {approveLoading ? <Spinner /> : <TickSvg />} - </Div> */} + </Section> ); }; @@ -103,9 +99,9 @@ const Button = styled.button<IThemeProps>` border: none; cursor: pointer; border-radius: 8px; - background: ${(props) => props.theme.accentBgColor}; + background: ${(props) => props.theme.backgroundColor.buttonBackground}; border: none; - color: white; + color: ${(props) => props.theme.textColor.buttonText}; width: 100%; font-size: 16px; font-weight: 600; diff --git a/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx b/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx index 220aef905..b63b1ee00 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx @@ -1,12 +1,17 @@ import React, { useContext, useEffect, useRef, useState } from 'react'; -import { ChatDataContext } from '../../../context'; + +import { + IFeeds, + IMessageIPFS, + IMessageIPFSWithCID, +} from '@pushprotocol/restapi'; +import moment from 'moment'; +import styled from 'styled-components'; + import { IChatViewListProps } from '../exportedTypes'; import { chatLimit } from '../../../config'; -import { IFeeds, IMessageIPFS } from '@pushprotocol/restapi'; import useFetchHistoryMessages from '../../../hooks/chat/useFetchHistoryMessages'; -import styled from 'styled-components'; -import { Div, Section, Span, Spinner } from '../../reusables'; -import moment from 'moment'; +import { Section, Span, Spinner } from '../../reusables'; import { ChatViewBubble } from '../ChatViewBubble'; import { appendUniqueMessages, @@ -16,14 +21,14 @@ import { getDefaultFeedObject, getNewChatUser, pCAIP10ToWallet, + walletToPCAIP10, } from '../../../helpers'; import { useChatData, usePushChatSocket } from '../../../hooks'; import { Messagetype } from '../../../types'; import { ThemeContext } from '../theme/ThemeProvider'; import { IChatTheme } from '../theme'; -import useFetchConversationHash from '../../../hooks/chat/useFetchConversationHash'; -import { EncryptionMessage } from './MessageEncryption'; +import { ENCRYPTION_KEYS, EncryptionMessage } from './MessageEncryption'; import useGetGroup from '../../../hooks/chat/useGetGroup'; import useGetChatProfile from '../../../hooks/useGetChatProfile'; import useFetchChat from '../../../hooks/chat/useFetchChat'; @@ -35,6 +40,7 @@ import { ApproveRequestBubble } from './ApproveRequestBubble'; */ interface IThemeProps { theme?: IChatTheme; + blur: boolean; } const ChatStatus = { FIRST_CHAT: `This is your first conversation with recipient.\n Start the conversation by sending a message.`, @@ -44,23 +50,24 @@ const ChatStatus = { export const ChatViewList: React.FC<IChatViewListProps> = ( options: IChatViewListProps ) => { - const { chatId, limit = chatLimit } = options || {}; - const { pgpPrivateKey, account } = useChatData(); + const { chatId, limit = chatLimit, chatFilterList = [] } = options || {}; + const { pgpPrivateKey, account, connectedProfile, setConnectedProfile } = + useChatData(); const [chatFeed, setChatFeed] = useState<IFeeds>({} as IFeeds); const [chatStatusText, setChatStatusText] = useState<string>(''); const [messages, setMessages] = useState<Messagetype>(); - const [ loading,setLoading] = useState<boolean>(true); + const [loading, setLoading] = useState<boolean>(true); const [conversationHash, setConversationHash] = useState<string>(); - const { historyMessages, loading:messageLoading } = useFetchHistoryMessages(); + const { historyMessages, loading: messageLoading } = + useFetchHistoryMessages(); const listInnerRef = useRef<HTMLDivElement>(null); - const bottomRef = useRef<HTMLDivElement>(null); + const [isMember, setIsMember] = useState<boolean>(false); const { fetchChat } = useFetchChat(); const { fetchChatProfile } = useGetChatProfile(); const { getGroup } = useGetGroup(); const { messagesSinceLastConnection, groupInformationSinceLastConnection } = usePushChatSocket(); - const { fetchConversationHash } = useFetchConversationHash(); const theme = useContext(ThemeContext); const dates = new Set(); const { env } = useChatData(); @@ -69,15 +76,29 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( setChatStatusText(''); }, [chatId, account, env]); + useEffect(() => { + (async () => { + if (!connectedProfile && account) { + const user = await fetchChatProfile({ profileId: account!, env }); + if (user) setConnectedProfile(user); + } + })(); + }, [account]); + useEffect(() => { setMessages(undefined); setConversationHash(undefined); }, [chatId, account, pgpPrivateKey, env]); + //need to make a common method for fetching chatFeed to ruse in messageInput useEffect(() => { (async () => { + if (!account && !env) return; const chat = await fetchChat({ chatId }); - if (Object.keys(chat || {}).length) setChatFeed(chat as IFeeds); + if (Object.keys(chat || {}).length) { + setConversationHash(chat?.threadhash as string); + setChatFeed(chat as IFeeds); + } else { let newChatFeed; let group; @@ -98,24 +119,26 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( if (!newChatFeed?.groupInformation) { setChatStatusText(ChatStatus.FIRST_CHAT); } - console.log(chatFeed) + setConversationHash(newChatFeed.threadhash as string); setChatFeed(newChatFeed); } else { setChatStatusText(ChatStatus.INVALID_CHAT); } - } setLoading(false); })(); }, [chatId, pgpPrivateKey, account, env]); + //moniters socket changes useEffect(() => { if (checkIfSameChat(messagesSinceLastConnection, account!, chatId)) { + const updatedChatFeed = chatFeed; + updatedChatFeed.msg = messagesSinceLastConnection; if (!Object.keys(messages || {}).length) { - setMessages({ - messages: [messagesSinceLastConnection], - lastThreadHash: messagesSinceLastConnection.cid, - }); + setFilteredMessages([ + messagesSinceLastConnection, + ] as IMessageIPFSWithCID[]); + setConversationHash(messagesSinceLastConnection.cid); } else { const newChatViewList = appendUniqueMessages( @@ -123,21 +146,26 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( [messagesSinceLastConnection], false ); - setMessages({ - messages: newChatViewList, - lastThreadHash: messages!.lastThreadHash, - }); + setFilteredMessages(newChatViewList as IMessageIPFSWithCID[]); } - scrollToBottom(null); + setChatStatusText(''); + setChatFeed(updatedChatFeed); + scrollToBottom(); } }, [messagesSinceLastConnection]); useEffect(() => { - (async function () { - const hash = await fetchConversationHash({ conversationId: chatId }); - setConversationHash(hash?.threadHash); - })(); - }, [chatId, account, env, pgpPrivateKey]); + if (Object.keys(groupInformationSinceLastConnection || {}).length) { + if ( + chatFeed?.groupInformation?.chatId.toLowerCase() === + groupInformationSinceLastConnection.chatId.toLowerCase() + ) { + const updateChatFeed = chatFeed; + updateChatFeed.groupInformation = groupInformationSinceLastConnection; + setChatFeed(updateChatFeed); + } + } + }, [groupInformationSinceLastConnection]); useEffect(() => { if (conversationHash) { @@ -145,10 +173,10 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( await getMessagesCall(); })(); } - }, [conversationHash, pgpPrivateKey, account, env]); + }, [conversationHash, pgpPrivateKey, account, env,chatFeed]); useEffect(() => { - scrollToBottom(null); + scrollToBottom(); }, [conversationHash]); useEffect(() => { @@ -158,42 +186,35 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( messages?.messages.length && messages?.messages.length <= limit ) { - scrollToBottom(null); + setChatStatusText(''); + scrollToBottom(); } }, [messages]); - useEffect(() => { - if ( - Object.keys(messagesSinceLastConnection || {}).length && - Object.keys(chatFeed || {}).length && - checkIfSameChat(messagesSinceLastConnection, account!, chatId) - ) { - const updatedChatFeed = chatFeed; - updatedChatFeed.msg = messagesSinceLastConnection; + useEffect(()=>{ - setChatStatusText(''); - setChatFeed(updatedChatFeed); + if(chatFeed && !chatFeed?.groupInformation?.isPublic && account) + { + chatFeed?.groupInformation?.members.forEach((acc) => { + if ( + acc.wallet.toLowerCase() === walletToPCAIP10(account!).toLowerCase() + ) { + setIsMember(true); + } + }); } - }, [messagesSinceLastConnection]); + },[account,chatFeed]) - const scrollToBottom = (behavior?: string | null) => { - bottomRef?.current?.scrollIntoView( - !behavior ? true : { behavior: 'smooth' } - ); - }; + //methods + const scrollToBottom = () => { + setTimeout(()=>{ + if (listInnerRef.current) { + listInnerRef.current.scrollTop = listInnerRef.current.scrollHeight +100; - useEffect(() => { - if (Object.keys(groupInformationSinceLastConnection || {}).length) { - if ( - chatFeed?.groupInformation?.chatId.toLowerCase() === - groupInformationSinceLastConnection.chatId.toLowerCase() - ) { - const updateChatFeed = chatFeed; - updateChatFeed.groupInformation = groupInformationSinceLastConnection; - setChatFeed(updateChatFeed); } - } - }, [groupInformationSinceLastConnection]); + },0) + + }; const onScroll = async () => { if (listInnerRef.current) { @@ -218,7 +239,13 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( } else { threadHash = messages?.lastThreadHash; } - if (threadHash && account) { + + if ( + threadHash && + ((account && pgpPrivateKey&& chatFeed && !chatFeed?.groupInformation) || + (chatFeed && chatFeed?.groupInformation)) + ) { + const chatHistory = await historyMessages({ limit: limit, threadHash, @@ -230,34 +257,50 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( chatHistory, true ); - setMessages({ - messages: newChatViewList, - lastThreadHash: chatHistory[0].link, - }); + + setFilteredMessages(newChatViewList as IMessageIPFSWithCID[]); } else { - setMessages({ - messages: chatHistory, - lastThreadHash: chatHistory[0].link, - }); + setFilteredMessages(chatHistory as IMessageIPFSWithCID[]); } } } }; + const setFilteredMessages = (messageList: Array<IMessageIPFSWithCID>) => { + const updatedMessageList = messageList.filter( + (msg) => !chatFilterList.includes(msg.cid) + ); + + if (updatedMessageList && updatedMessageList.length) { + setMessages({ + messages: updatedMessageList, + lastThreadHash: updatedMessageList[0].link, + }); + } + }; + + const ifBlurChat = () =>{ + return !!( + chatFeed && + chatFeed?.groupInformation && + !chatFeed?.groupInformation?.isPublic && + ((!isMember && pgpPrivateKey) || (!pgpPrivateKey)) + ); + } + type RenderDataType = { chat: IMessageIPFS; dateNum: string; }; - const renderDate = ({ chat, dateNum }: RenderDataType) => { const timestampDate = dateToFromNowDaily(chat.timestamp as number); dates.add(dateNum); return ( <Span margin="15px 0" - fontSize="14px" - fontWeight="600" - color={theme.textColorSecondary} + fontSize={theme.fontSize?.timestamp} + fontWeight={theme.fontWeight?.timestamp} + color={theme.textColor?.timestamp} textAlign="center" > {timestampDate} @@ -273,67 +316,93 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( justifyContent="start" padding="0 2px" theme={theme} - onScroll={() => onScroll()} + blur={ + ifBlurChat() + } + onScroll={(e) => { + e.stopPropagation(); + onScroll(); + }} > - {loading ? <Spinner color={theme.accentBgColor} /> : ''} - {!loading && - <> - {chatFeed && - (chatFeed.publicKey || - (chatFeed?.groupInformation && - !chatFeed?.groupInformation?.isPublic)) ? ( - <EncryptionMessage id={'ENCRYPTED'}/> - ) : ( - <EncryptionMessage id={'NO_ENCRYPTED'} /> - )} + {loading ? <Spinner color={theme.spinnerColor} /> : ''} + {!loading && ( + <> + {chatFeed && + (chatFeed.publicKey || + (chatFeed?.groupInformation && + !chatFeed?.groupInformation?.isPublic)) ? ( + <EncryptionMessage id={ENCRYPTION_KEYS.ENCRYPTED} /> + ) : ( + <EncryptionMessage + id={ + chatFeed?.groupInformation + ? ENCRYPTION_KEYS.NO_ENCRYPTED_GROUP + : ENCRYPTION_KEYS.NO_ENCRYPTED + } + /> + )} - {chatStatusText && ( - <Section margin="20px 0 0 0"> - <Span - fontSize="13px" - color={theme.textColorSecondary} - fontWeight="400" - > - {chatStatusText} - </Span> - </Section> - )} - {messageLoading ? <Spinner color={theme.accentBgColor} /> : ''} - - { - !messageLoading && - <> - <Section flexDirection="column" justifyContent="start" width="100%"> - {messages?.messages && - messages?.messages?.map((chat: IMessageIPFS, index: number) => { - const dateNum = moment(chat.timestamp).format('L'); - const position = - pCAIP10ToWallet(chat.fromDID).toLowerCase() !== - account?.toLowerCase() - ? 0 - : 1; - return ( - <> - {dates.has(dateNum) ? null : renderDate({ chat, dateNum })} - <Section justifyContent={position ? 'end' : 'start'}> - <ChatViewBubble chat={chat} key={index} /> - </Section> - </> - ); - })} - <div ref={bottomRef} /> - </Section> - {chatFeed && checkIfIntent({ chat: chatFeed as IFeeds, account: account! }) && ( - <ApproveRequestBubble - chatFeed={chatFeed} - chatId={chatId} - setChatFeed={setChatFeed} - /> + {chatStatusText && ( + <Section margin="20px 0 0 0"> + <Span + fontSize="13px" + color={theme.textColor?.encryptionMessageText} + fontWeight="400" + > + {chatStatusText} + </Span> + </Section> + )} + {messageLoading ? <Spinner color={theme.spinnerColor} /> : ''} + + {!messageLoading && ( + <> + <Section + flexDirection="column" + justifyContent="start" + width="100%" + > + {messages?.messages && + messages?.messages?.map( + (chat: IMessageIPFS, index: number) => { + const dateNum = moment(chat.timestamp).format('L'); + const position = + pCAIP10ToWallet(chat.fromDID).toLowerCase() !== + account?.toLowerCase() + ? 0 + : 1; + return ( + <> + {dates.has(dateNum) + ? null + : renderDate({ chat, dateNum })} + <Section + justifyContent={position ? 'end' : 'start'} + margin="7px" + > + <ChatViewBubble chat={chat} key={index} /> + </Section> + </> + ); + } + )} + </Section> + {chatFeed && + account && + checkIfIntent({ + chat: chatFeed as IFeeds, + account: account!, + }) && ( + <ApproveRequestBubble + chatFeed={chatFeed} + chatId={chatId} + setChatFeed={setChatFeed} + /> + )} + </> + )} + </> )} - </> - } - </> - } </ChatViewListCard> ); }; @@ -341,11 +410,19 @@ export const ChatViewList: React.FC<IChatViewListProps> = ( //styles const ChatViewListCard = styled(Section)<IThemeProps>` &::-webkit-scrollbar-thumb { - background: ${(props) => props.theme.accentBgColor}; + background: ${(props) => props.theme.scrollbarColor}; border-radius: 10px; } &::-webkit-scrollbar { width: 5px; } + ${({ blur }) => + blur && + ` + filter: blur(12px); + `} + overscroll-behavior: contain; + scroll-behavior: smooth; `; + diff --git a/packages/uiweb/src/lib/components/chat/ChatViewList/MessageEncryption.tsx b/packages/uiweb/src/lib/components/chat/ChatViewList/MessageEncryption.tsx index d2519e6ed..74e307637 100644 --- a/packages/uiweb/src/lib/components/chat/ChatViewList/MessageEncryption.tsx +++ b/packages/uiweb/src/lib/components/chat/ChatViewList/MessageEncryption.tsx @@ -6,6 +6,14 @@ import { ThemeContext } from "../theme/ThemeProvider"; import { NoEncryptionIcon } from "../../../icons/NoEncryption"; import { EncryptionIcon } from "../../../icons/Encryption"; +export const ENCRYPTION_KEYS = { + ENCRYPTED: 'ENCRYPTED', + NO_ENCRYPTED: 'NO_ENCRYPTED', + NO_ENCRYPTED_GROUP: 'NO_ENCRYPTED_GROUP' +} as const; + +export type EncryptionKeys = (typeof ENCRYPTION_KEYS)[keyof typeof ENCRYPTION_KEYS]; + const EncryptionMessageContent = { ENCRYPTED: { IconComponent: <EncryptionIcon size="15" />, @@ -14,10 +22,15 @@ const EncryptionMessageContent = { NO_ENCRYPTED: { IconComponent: <NoEncryptionIcon size="15" />, text: `Messages are not encrypted`, + }, + NO_ENCRYPTED_GROUP: { + IconComponent: <NoEncryptionIcon size="15" />, + text: `Messages in this group are not encrypted`, + }, + }; - export const EncryptionMessage = ({ id }: { id: 'ENCRYPTED' | 'NO_ENCRYPTED' }) => { - console.log(id) + export const EncryptionMessage = ({ id }: { id: EncryptionKeys}) => { const theme = useContext(ThemeContext); const isMobile = useDeviceWidthCheck(771); return ( @@ -25,7 +38,7 @@ const EncryptionMessageContent = { padding="10px" alignSelf="center" borderRadius="12px" - background={theme.bgColorPrimary} + background={theme.backgroundColor?.encryptionMessageBackground} margin="10px 10px 0px" width={isMobile ? '80%' : 'fit-content'} > @@ -35,7 +48,7 @@ const EncryptionMessageContent = { <Span fontSize="13px" margin="0 0 0 5px" - color={theme.textColorSecondary} + color={theme.textColor?.encryptionMessageText} fontWeight="400" textAlign="left" > diff --git a/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx b/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx index d196b00b7..b0090d41a 100644 --- a/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx +++ b/packages/uiweb/src/lib/components/chat/ConnectButton/ConnectButton.tsx @@ -1,174 +1,134 @@ -import React, { useContext, useEffect } from "react"; -import styled from "styled-components"; -import { InjectedConnector } from "@web3-react/injected-connector"; -import { useWeb3React } from "@web3-react/core"; -import { useChatData } from "../../../hooks"; -import * as PUSHAPI from "@pushprotocol/restapi" -import { Spinner } from "../../reusables"; -import { ThemeContext } from "../theme/ThemeProvider"; - -interface NwMappingType { - [key: number]: string; +import { useContext, useEffect, useState } from 'react'; + +import styled from 'styled-components'; +import { Signer, ethers } from 'ethers'; + +import { useAccount, useChatData } from '../../../hooks'; +import { ThemeContext } from '../theme/ThemeProvider'; +import useGetChatProfile from '../../../hooks/useGetChatProfile'; +import useCreateChatProfile from '../../../hooks/useCreateChatProfile'; +import useDecryptPGPKey from '../../../hooks/useDecryptPGPKey'; + +import { getAddressFromSigner } from '../../../helpers'; +import { IChatTheme } from '../theme'; +import { device } from '../../../config'; + +/** + * @interface IThemeProps + * this interface is used for defining the props for styled components + */ +interface IThemeProps { + theme?: IChatTheme; +} +interface IConnectButtonProps { + autoConnect?: boolean; } - -const NETWORK_MAPPING: NwMappingType = { - 1: 'ETH_MAIN_NET', - 5: 'ETH_GOERLI', - 3: 'ETH_ROPSTEN', - 137: 'POLYGON_MAINNET', - 80001: 'POLYGON_MUMBAI', - 56: 'BSC_MAINNET', - 97: 'BSC_TESTNET', - 420: 'OPTIMISM_TESTNET', - 10: 'OPTIMISM_MAINNET', - 1442: 'POLYGON_ZK_EVM_TESTNET', - 1101: 'POLYGON_ZK_EVM_MAINNET', -}; - -const injected = new InjectedConnector({ - supportedChainIds: [1, 3, 4, 5, 42, 137, 80001, 56, 97, 10, 420, 1442, 1101], -}); - -const ConnectWrapper = styled.div` - display: flex; - align-items: center; - flex-direction: column; - margin: 20; - - & .account { - font-size: 1.2rem; - border: 1px solid green; - border-radius: 3px; - padding: 4px 7px; - font-weight: 500; - font-family: monospace; - } - - & .network { - margin: 5px 0; +export const ConnectButtonSub = ({autoConnect = false}) => { + const {wallet, connecting , connect, disconnect} = useAccount(); + + const { + signer, + pgpPrivateKey, + account, + env, + setPgpPrivateKey, + setAccount, + setSigner, + } = useChatData(); + const theme = useContext(ThemeContext); + const {fetchChatProfile} = useGetChatProfile(); + const {creteChatProfile} = useCreateChatProfile(); + const {decryptPGPKey} = useDecryptPGPKey(); + + + const setUserData = () => { + if (wallet) { + (async () => { + const ethersProvider = new ethers.providers.Web3Provider(wallet.provider, 'any') + const signer = ethersProvider.getSigner() + const newAdd = await getAddressFromSigner(signer) + setSigner(signer) + setAccount(newAdd); + })() + } else if (!wallet) { + setAccount('') + setSigner(undefined) + setPgpPrivateKey(null) } - `; - -const StyledButton = styled.button` - border: 0px; - outline: 0px; - padding: 24px 9px; - font-weight: 500; - margin: 10px; - border-radius: 12px; - font-size: 17px; - cursor: pointer; - width: 165px; - height: 44px; - text-align: start; - align-items: center; - display: flex; - justify-content: center; - `; - -const Connect = styled(StyledButton)` - color: rgb(255, 255, 255); - background: #D53A94; - `; - -const Disconnect = styled(StyledButton)` -display: flex; -padding: 9px 24px; -justify-content: center; -align-items: center; -gap: 10px; -background: var(--general-use-creamy-pink, #D53A94); -color: var(--general-use-white, #ffffff); - `; - -export const ConnectButton = () => { - const { active, activate, library } = useWeb3React(); - const { pgpPrivateKey, account, env, setPgpPrivateKey } = useChatData(); - const theme = useContext(ThemeContext); - - useEffect(() => { - if (active && account && env && library) { - const librarySigner = library.getSigner(); - - const connectBtn = async () => { - const user = await PUSHAPI.user.get({ account: account, env: env }); - if (!user) { - await createProfile(); - } - if (user?.encryptedPrivateKey && !pgpPrivateKey) { - const decryptPgpKey = await PUSHAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: user.encryptedPrivateKey, - account: account, - signer: librarySigner, - env: env, - }); - setPgpPrivateKey(decryptPgpKey); - } - }; - - connectBtn(); - } - }, [active, account, env, library]); - - const createProfile = async () => { - if (!account || !env || !library) return; - - const librarySigner = library.getSigner(); - - const user = await PUSHAPI.user.create({ - signer: librarySigner, - env: env, - }); - - const createdUser = await PUSHAPI.user.get({ - account: account, - env: env, - }); - - const pvtKey = await PUSHAPI.chat.decryptPGPKey({ - encryptedPGPPrivateKey: createdUser.encryptedPrivateKey ? createdUser.encryptedPrivateKey : "", - signer: librarySigner, - env: env, - toUpgrade: true, + } + useEffect(() => { + if(wallet && !autoConnect) + disconnect(wallet); + setUserData() + }, [wallet]) + + useEffect(() => { + (async () => { + if (account && signer) { + if (!pgpPrivateKey) await handleUserCreation(); + } + })(); + }, [account, signer]); + + + const handleUserCreation = async () => { + if (!account && !env) return; + try { + let user = await fetchChatProfile({ profileId: account! ,env}); + if (!user) { + if (!signer) return; + user = await creteChatProfile({ signer: signer ,env}); + } + if (user?.encryptedPrivateKey && !pgpPrivateKey) { + const decryptPgpKey = await decryptPGPKey({ + encryptedPrivateKey: user.encryptedPrivateKey, + account: account!, + signer: signer, + env: env, }); - - setPgpPrivateKey(pvtKey); - }; - - async function connect() { - try { - await activate(injected); - } catch (ex) { - console.log(ex); - } + if(decryptPgpKey) + setPgpPrivateKey(decryptPgpKey); + } + } catch (e: any) { + console.log(e); } + }; + return !signer ? ( + <ConnectButtonDiv theme={theme}> + <button onClick={() => (wallet ? disconnect(wallet) : connect())}>{connecting ? 'connecting' : wallet ? 'disconnect' : 'Connect Wallet'}</button> + </ConnectButtonDiv> + ) : ( + <></> + ); +}; - const connectWalletOnPageLoad = async () => { - if (!pgpPrivateKey && !account) { - try { - await activate(injected); - } catch (ex) { - console.log(ex); - } - } - }; - - useEffect(() => { - connectWalletOnPageLoad(); - }, [activate]); - - return ( - <ConnectWrapper> - {active ? ( - <> - <Connect theme={theme}> - <Spinner color={'white'} size="22" /> - </Connect> - </> - ) : ( - <Connect onClick={connect}>Connect Wallet</Connect> - )} - </ConnectWrapper> - ); -}; \ No newline at end of file +//styles +const ConnectButtonDiv = styled.div<IThemeProps>` + width: fit-content; + + button{ + background: ${(props) => `${props.theme.backgroundColor.buttonBackground}!important`}; + color: ${(props) => `${props.theme.textColor.buttonText}!important`}; + text-align:center; + font-size: 1em; + cursor:pointer; + border-radius: 10px; + padding: 10px 20px; + outline: none; + border: none; + cursor: pointer; + font-weight: 600; + + } + button:hover{ + scale: 1.05; + transition: 0.3s; + } + @media ${device.mobileL} { + font-size: 12px; + } + body.modal-open { + overflow-y: hidden; + } +`; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/ConnectButton/index.ts b/packages/uiweb/src/lib/components/chat/ConnectButton/index.ts deleted file mode 100644 index d5457ba77..000000000 --- a/packages/uiweb/src/lib/components/chat/ConnectButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { ConnectButton } from './ConnectButton'; diff --git a/packages/uiweb/src/lib/components/chat/ConnectButton/index.tsx b/packages/uiweb/src/lib/components/chat/ConnectButton/index.tsx new file mode 100644 index 000000000..b6b603fdf --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/ConnectButton/index.tsx @@ -0,0 +1,100 @@ +import { IChatTheme } from '../theme'; + +import coinbaseWalletModule from '@web3-onboard/coinbase' +import { ConnectButtonSub } from './ConnectButton'; +import { BLOCKNATIVE_PROJECT_ID, InfuraAPIKey } from '../../../config'; +import { Web3OnboardProvider } from '@web3-onboard/react'; +import injectedModule, { ProviderLabel } from '@web3-onboard/injected-wallets'; +import walletConnectModule from '@web3-onboard/walletconnect' +import init from '@web3-onboard/core'; + +const APP_META_DATA = { + name: 'Push Protocol', + icon: 'https://files.slack.com/files-pri/T011WQBLH39-F05QWQA0MSR/pushlogoblocknative.png', + description: 'Example showcasing how to connect a wallet.', + + recommendedInjectedWallets: [ + { name: 'MetaMask', url: 'https://metamask.io' }, + ] +} + +const wcv2InitOptions = { + projectId: BLOCKNATIVE_PROJECT_ID, + requiredChains: [1, 56] +} + +const walletConnect = walletConnectModule(wcv2InitOptions) +const coinbaseWalletSdk = coinbaseWalletModule({ darkMode: true }) +const CHAINS = [ + { + id: '0x1', + token: 'ETH', + label: 'Ethereum Mainnet', + rpcUrl: `https://mainnet.infura.io/v3/${InfuraAPIKey}` + }, + { + id: '0x5', + token: 'ETH', + label: 'Goerli', + rpcUrl: `https://goerli.infura.io/v3/${InfuraAPIKey}` + }, + { + id: '0x13881', + token: 'MATIC', + label: 'Polygon - Mumbai', + rpcUrl: 'https://matic-mumbai.chainstacklabs.com' + }, + { + id: '0x38', + token: 'BNB', + label: 'Binance', + rpcUrl: 'https://bsc-dataseed.binance.org/' + }, + { + id: '0xA', + token: 'OETH', + label: 'Optimism', + rpcUrl: 'https://mainnet.optimism.io' + }, + { + id: '0xA4B1', + token: 'ARB-ETH', + label: 'Arbitrum', + rpcUrl: 'https://rpc.ankr.com/arbitrum' + } +] + + +const wallets = [injectedModule(), walletConnect, coinbaseWalletSdk] + + + + +const web3OnBoard = init({ + wallets, + chains:CHAINS, + appMetadata:APP_META_DATA, + accountCenter: { + desktop: { + enabled: false + }, + mobile: { + enabled: false + } + }, + connect: { + autoConnectLastWallet: true, + } +}) + +interface IConnectButtonCompProps { + autoConnect?: boolean; +} + +export const ConnectButtonComp: React.FC<IConnectButtonCompProps> = ({ autoConnect }) => { + return ( + <Web3OnboardProvider web3Onboard={web3OnBoard}> + <ConnectButtonSub autoConnect={autoConnect} /> + </Web3OnboardProvider> + ); +}; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/AddButtons.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/AddButtons.tsx new file mode 100644 index 000000000..73b56e0c5 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/AddButtons.tsx @@ -0,0 +1,27 @@ +import React, { useContext } from 'react' + +import { Button } from '../reusables' +import { ThemeContext } from '../theme/ThemeProvider'; + +interface AddButtonsProps { + title: string; + handleNext?: () => void; +} + +export const AddButtons = ({title, handleNext}: AddButtonsProps) => { + const theme = useContext(ThemeContext); + return ( + <Button + customStyle={{ + color: `${theme.backgroundColor?.buttonBackground}`, + fontSize: '15px', + fontWeight: '500', + border: `${theme.border?.modalInnerComponents}`, + background: 'transparent', + }} + onClick={handleNext} + > + {title} + </Button> + ) +} diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx new file mode 100644 index 000000000..8f9bbd0c2 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/AddCriteria.tsx @@ -0,0 +1,557 @@ +import { useContext, useEffect, useState } from 'react'; + +import { + Button, + DropDownInput, + DropdownValueType, + ModalHeader, + TextInput, +} from '../reusables'; +import { Section, } from '../../reusables'; +import useMediaQuery from '../../../hooks/useMediaQuery'; +import { GatingRulesInformation, ModalHeaderProps } from './CreateGroupModal'; +import { useChatData } from '../../../hooks'; +import { QuantityInput } from '../reusables/QuantityInput'; +import { ThemeContext } from '../theme/ThemeProvider'; +import { Checkbox } from '../reusables/Checkbox'; +import OptionButtons from '../reusables/OptionButtons'; + +import EthereumSvg from '../../../icons/ethereum.svg'; +import PolygonSvg from '../../../icons/polygon.svg'; +import BSCSvg from '../../../icons/bsc.svg'; +import OptimismSvg from '../../../icons/optimisim.svg'; +import { BLOCKCHAIN_NETWORK, device } from '../../../config'; +import { GUILD_COMPARISON_OPTIONS, INVITE_CHECKBOX_LABEL } from '../constants'; +import { + CATEGORY, + DropdownCategoryValuesType, + DropdownSubCategoryValuesType, + SUBCATEGORY, + TYPE, + SubCategoryKeys, + TypeKeys, + ReadonlyInputType, +} from '../types'; +import { Data, GuildData, PushData, Rule } from '../types/tokenGatedGroupCreationType'; + + + +const AddCriteria = ({ + handlePrevious, + handleNext, + onClose, + criteriaStateManager +}: ModalHeaderProps) => { + const [selectedTypeValue, setSelectedTypeValue] = useState<number>(0); + const [selectedCategoryValue, setSelectedCategoryValue] = useState<number>(0); + const [selectedSubCategoryValue, setSelectedSubCategoryValue] = + useState<number>(0); + const [guildComparison, setGuildComparison] = useState('') + const [selectedChainValue, setSelectedChainValue] = useState<number>(0); + const [contract, setContract] = useState<string>(''); + const [inviteCheckboxes, setInviteCheckboxes] = useState<{ + admin: boolean; + owner: boolean; + }>({ admin: true, owner: true }); + const [url, setUrl] = useState<string>(''); + const [guildId, setGuildId] = useState<string>(''); + const [specificRoleId, setSpecificRoleId] = useState<string>(''); + + const [quantity, setQuantity] = useState<{ value: number; range: number }>({ + value: 0, + range: 0, + }); + const { env } = useChatData(); + const theme = useContext(ThemeContext); + + const isMobile = useMediaQuery(device.mobileL); + + const dropdownQuantityRangeValues: Array<DropdownValueType> = [ + { + id: 0, + title: 'Greater than', + value: '>', + function: () => setQuantity({ ...quantity, range: 0 }), + }, + { + id: 1, + title: 'Greater or equal to', + value: '>=', + function: () => setQuantity({ ...quantity, range: 1 }), + }, + { + id: 2, + title: 'Less than', + value: '<', + function: () => setQuantity({ ...quantity, range: 2 }), + }, + { + id: 3, + title: 'Less or equal to', + value: '<=', + function: () => setQuantity({ ...quantity, range: 3 }), + }, + { + id: 4, + title: 'Equal to', + value: '==', + function: () => setQuantity({ ...quantity, range: 4 }), + }, + { + id: 5, + title: 'Not equal to', + value: '!=', + function: () => setQuantity({ ...quantity, range: 5 }), + }, + ]; + const dropdownTypeValues: Array<DropdownValueType> = [ + { + id: 0, + title: 'Push protocol', + value: TYPE.PUSH, + function: () => setSelectedTypeValue(0), + }, + { + id: 1, + title: 'Guild', + value: TYPE.GUILD, + function: () => setSelectedTypeValue(1), + }, + ]; + const dropdownCategoryValues: DropdownCategoryValuesType = { + PUSH: [ + { + id: 0, + value: CATEGORY.ERC20, + title: 'Token ERC20', + function: () => setSelectedCategoryValue(0), + }, + { + id: 1, + value: CATEGORY.ERC721, + title: 'NFT ERC721', + function: () => setSelectedCategoryValue(1), + }, + { + id: 2, + value: CATEGORY.INVITE, + title: 'Invite', + function: () => setSelectedCategoryValue(2), + }, + { + id: 3, + value: CATEGORY.CustomEndpoint, + title: 'Custom Endpoint', + function: () => setSelectedCategoryValue(3), + }, + ], + GUILD: { + value: CATEGORY.ROLES, + title: 'Roles', + }, + }; + + const tokenCategoryValues = [ + { + id: 0, + value: SUBCATEGORY.HOLDER, + title: 'Holder', + function: () => setSelectedSubCategoryValue(0), + }, + { + id: 1, + value: SUBCATEGORY.OWENER, + title: 'Owner', + function: () => setSelectedSubCategoryValue(1), + }, + ]; + const dropdownSubCategoryValues: DropdownSubCategoryValuesType = { + ERC20: tokenCategoryValues, + ERC721: tokenCategoryValues, + INVITE: { + value: SUBCATEGORY.DEFAULT, + title: 'Default', + }, + CustomEndpoint: [ + { + id: 0, + value: SUBCATEGORY.GET, + title: 'Get', + function: () => setSelectedSubCategoryValue(0), + }, + ], + ROLES: { + value: SUBCATEGORY.DEFAULT, + title: 'Default', + }, + }; + + const dropdownChainsValues: Array<DropdownValueType> = [ + { + id: 0, + value: BLOCKCHAIN_NETWORK[env].ETHEREUM, + title: 'Ethereum', + icon: EthereumSvg, + function: () => setSelectedChainValue(0), + }, + { + id: 1, + value: BLOCKCHAIN_NETWORK[env].POLYGON, + title: 'Polygon', + icon: PolygonSvg, + function: () => setSelectedChainValue(1), + }, + { + id: 2, + value: BLOCKCHAIN_NETWORK[env].BSC, + title: 'BSC', + icon: BSCSvg, + function: () => setSelectedChainValue(2), + }, + { + id: 3, + value: BLOCKCHAIN_NETWORK[env].OPTIMISM, + title: 'Optimism', + icon: OptimismSvg, + function: () => setSelectedChainValue(3), + }, + ]; + + const getCategoryDropdownValues = () => { + return dropdownCategoryValues[ + dropdownTypeValues[selectedTypeValue].value as TypeKeys + ]; + }; + + const getSelectedCategoryValue = () => { + const category = getCategoryDropdownValues(); + if (Array.isArray(category)) + return (category as DropdownValueType[])[selectedCategoryValue].value!; + else return category.value! as SubCategoryKeys; + }; + + const getSelectedSubCategoryValue = () => { + const subCategory = getSubCategoryDropdownValues(); + if (Array.isArray(subCategory)) + return (subCategory as DropdownValueType[])[selectedCategoryValue].value!; + else return subCategory.value! as SubCategoryKeys; + }; + + const checkIfTokenNFT = () => { + const category = getSelectedCategoryValue(); + if (category === CATEGORY.ERC20 || category === CATEGORY.ERC721) + return true; + + return false; + }; + + const checkIfCustomEndpoint = () => { + const category = getSelectedCategoryValue(); + if (category === CATEGORY.CustomEndpoint) return true; + return false; + }; + + const checkIfPushInvite = () => { + const accessType = dropdownTypeValues[selectedTypeValue].value; + if (accessType === TYPE.PUSH) { + const category = getSelectedCategoryValue(); + if (category === CATEGORY.INVITE) return true; + } + + return false; + }; + + const checkIfGuild = () => { + const accessType = dropdownTypeValues[selectedTypeValue].value; + if (accessType === TYPE.GUILD) { + return true; + } + + return false; + }; + + const getSubCategoryDropdownValues = () => { + const category = getCategoryDropdownValues(); + if (Array.isArray(category)) + return dropdownSubCategoryValues[ + (category as DropdownValueType[])[selectedCategoryValue] + .value as SubCategoryKeys + ]; + else return dropdownSubCategoryValues[category.value as SubCategoryKeys]; + }; + + const onQuantityChange = (e: any) => { + setQuantity({ ...quantity, value: e.target.value }); + }; + + const verifyAndDoNext = ()=>{ + const _type = dropdownTypeValues[selectedTypeValue].value as 'PUSH' | 'GUILD' + const category:string = _type === "PUSH" ? (dropdownCategoryValues[_type] as DropdownValueType[])[ + selectedCategoryValue + ].value || CATEGORY.ERC20 : "ROLES" + + let subCategory = "DEFAULT" + if(_type === "PUSH"){ + if(category === CATEGORY.ERC20 || category === CATEGORY.ERC721){ + subCategory = tokenCategoryValues[selectedSubCategoryValue].value + }else if(category === CATEGORY.CustomEndpoint){ + subCategory = "GET" + } + } + + const getData = (type:string, category:string):Data=>{ + if(type === "PUSH"){ + if(category === CATEGORY.ERC20 || category === CATEGORY.ERC721){ + const selectedChain = dropdownChainsValues[selectedChainValue].value || 'eip155:1'; + return { + contract: `${selectedChain}:${contract}`, + amount: quantity.value, + comparison:dropdownQuantityRangeValues[quantity.range].value, + decimals: 18, + } + }else if(category === CATEGORY.INVITE){ + const _inviteRoles = [] + if(inviteCheckboxes.admin){ + _inviteRoles.push("ADMIN") + } + if(inviteCheckboxes.owner){ + _inviteRoles.push("OWNER") + } + + return{ + inviterRoles: _inviteRoles as ['OWNER' | 'ADMIN'] + } + }else{ + // CATEGORY.CustomEndpoint + // TODO: validate url + return{ + url:url + } + } + }else{ + // GUILD type + return { + id:guildId, + comparison:guildComparison, + role:guildComparison === 'specific' ? specificRoleId : "*", + } + } + } + + const rule:Rule = { + type: _type, + category: category, + subcategory: subCategory, + data: getData(_type, category), + } + + criteriaState.addNewRule(rule) + + if(handlePrevious){ + handlePrevious() + } + + } + + const criteriaState = criteriaStateManager.getSelectedCriteria() + + + // Autofill the form for the update + useEffect(()=>{ + if(criteriaState.isUpdateCriteriaEnabled()){ + //Load the states + const oldValue = criteriaState.selectedRules[criteriaState.updateCriteriaIdx] + + if(oldValue.type === 'PUSH'){ + + // category + setSelectedCategoryValue( + (dropdownCategoryValues.PUSH as DropdownValueType[]).findIndex(obj => obj.value === oldValue.category) + ) + + const pushData = oldValue.data as PushData + + // sub category + if(oldValue.category === CATEGORY.ERC20 || oldValue.category === CATEGORY.ERC721){ + setSelectedSubCategoryValue( + tokenCategoryValues.findIndex(obj => obj.value === oldValue.subcategory) + ) + + const contractAndChain:string[] = (pushData.contract || "eip155:1:0x").split(':') + setSelectedChainValue( + dropdownChainsValues.findIndex( + obj => obj.value === contractAndChain[0]+":"+contractAndChain[1] + ) + ) + setContract(contractAndChain.length === 3 ? contractAndChain[2]: "") + setQuantity({ + value:pushData.amount || 0, + range:dropdownQuantityRangeValues.findIndex( + obj => obj.value === pushData.comparison + ) + }) + }else if(oldValue.category === CATEGORY.INVITE){ + setInviteCheckboxes({ + admin:true, + owner:true, + }) + }else{ + // invite + setUrl(pushData.url || "") + } + }else{ + // guild condition + setGuildId((oldValue.data as GuildData).id) + setSpecificRoleId((oldValue.data as GuildData).role) + setGuildComparison((oldValue.data as GuildData).comparison) + } + + setSelectedTypeValue( + dropdownTypeValues.findIndex(obj => obj.value === oldValue.type) + ) + } + },[]) + + return ( + <Section + flexDirection="column" + gap="25px" + width={isMobile ? '300px' : '400px'} + > + <Section margin="0 0 10px 0"> + <ModalHeader + handleClose={onClose} + handlePrevious={handlePrevious} + title={criteriaState.isUpdateCriteriaEnabled() ? "Update Criteria" : "Add Criteria"} + /> + </Section> + <DropDownInput + labelName="Type" + selectedValue={selectedTypeValue} + dropdownValues={dropdownTypeValues} + /> + {Array.isArray(getCategoryDropdownValues()) ? ( + <DropDownInput + labelName="Gating Category" + selectedValue={selectedCategoryValue} + dropdownValues={getCategoryDropdownValues() as DropdownValueType[]} + /> + ) : ( + <TextInput + labelName="Gating category" + inputValue={(getCategoryDropdownValues() as ReadonlyInputType)?.title} + disabled={true} + customStyle={{ + background: theme.backgroundColor?.modalHoverBackground, + }} + /> + )} + + {Array.isArray(getSubCategoryDropdownValues()) ? ( + <DropDownInput + labelName="Sub-Category" + selectedValue={selectedSubCategoryValue} + dropdownValues={getSubCategoryDropdownValues() as DropdownValueType[]} + /> + ) : ( + <TextInput + labelName="Sub-category" + inputValue={(getSubCategoryDropdownValues() as ReadonlyInputType)?.title} + disabled={true} + customStyle={{ + background: theme.backgroundColor?.modalHoverBackground, + }} + /> + )} + {/* shift to minor components leave for now*/} + {checkIfTokenNFT() && ( + <> + <DropDownInput + labelName="Blockchain" + selectedValue={selectedChainValue} + dropdownValues={dropdownChainsValues} + /> + <TextInput + labelName="Contract" + inputValue={contract} + onInputChange={(e: any) => setContract(e.target.value)} + placeholder="e.g. 0x123..." + /> + <QuantityInput + dropDownValues={dropdownQuantityRangeValues} + labelName="Quantity" + inputValue={quantity} + onInputChange={onQuantityChange} + placeholder="e.g. 1.45678" + unit={'TOKEN'} + /> + </> + )} + + {checkIfCustomEndpoint() && ( + <TextInput + labelName="URL" + inputValue={url} + onInputChange={(e: any) => setUrl(e.target.value)} + placeholder="e.g. abc.com" + /> + )} + {checkIfPushInvite() && ( + <Section flexDirection="column" gap="10px"> + {Object.keys(INVITE_CHECKBOX_LABEL).map((key) => ( + <Checkbox + labelName={ + INVITE_CHECKBOX_LABEL[key as keyof typeof INVITE_CHECKBOX_LABEL] + } + onToggle={() => + setInviteCheckboxes({ + admin:true, + owner:true + }) + } + checked={ + inviteCheckboxes[key as keyof typeof INVITE_CHECKBOX_LABEL] + } + /> + ))} + </Section> + )} + + {checkIfGuild() && ( + <> + <TextInput + labelName="ID" + inputValue={guildId} + onInputChange={(e: any) => setGuildId(e.target.value)} + placeholder="e.g. 4687" + /> + <OptionButtons + options={GUILD_COMPARISON_OPTIONS} + totalWidth="410px" + selectedValue={guildComparison} + handleClick={(newEl:string)=>{ + setGuildComparison(newEl)}} + /> + + {guildComparison === "specific" && + <TextInput + labelName="Specific Role" + inputValue={specificRoleId} + onInputChange={(e: any) => setSpecificRoleId(e.target.value)} + placeholder="e.g. 4687" + /> + } + + + </> + )} + <Button width="197px" onClick={verifyAndDoNext}> + {criteriaState.isUpdateCriteriaEnabled() ? "Update" : "Add"} + </Button> + <GatingRulesInformation /> + </Section> + ); +}; + +export default AddCriteria; + diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx new file mode 100644 index 000000000..4efb0d594 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/ConditionsComponent.tsx @@ -0,0 +1,322 @@ +import React, { useContext, useRef, useState } from 'react'; + +import styled from 'styled-components'; + +import { Section, Span } from '../../reusables'; +import { MoreDarkIcon } from '../../../icons/MoreDark'; +import { ThemeContext } from '../theme/ThemeProvider'; +import Dropdown, { DropdownValueType } from '../reusables/DropDown'; +import { ConditionArray, ConditionData, IChatTheme } from '../exportedTypes'; +import { useClickAway } from '../../../hooks'; +import { CATEGORY, CRITERIA_TYPE, CriteriaType, TOKEN_NFT_COMPARISION, TokenNftComparision } from '../types'; + +import EditSvg from '../../../icons/EditSvg.svg'; +import RemoveSvg from '../../../icons/RemoveSvg.svg'; +import { shortenText } from '../../../helpers'; +import { GUILD_COMPARISON_OPTIONS } from '../constants'; + +export type CriteraValueType = { + invertedIcon?: any; + id: number; + type?: string; + title?: string; + icon?: string; + function: () => void; +}; + +interface CriteriaProps { + conditionData: ConditionArray[]; + moreOptions?: boolean; + deleteFunction?: (idx: number) => void; + updateFunction?: (idx: number) => void; +} + +interface MoreOptionsContainerProps { + handleMoreOptionsClick: (row: number, col: number) => void; + setSelectedIndex: any; + selectedIndex: Array<number> | null; + row: number; + col: number; + dropDownValues: DropdownValueType[]; +} + +// fix dropdown position mobile view and z index +const MoreOptionsContainer = ({ + handleMoreOptionsClick, + setSelectedIndex, + selectedIndex, + row, + col, + dropDownValues, +}: MoreOptionsContainerProps) => { + const theme = useContext(ThemeContext); + const dropdownRef = useRef<any>(null); + + useClickAway(dropdownRef, () => setSelectedIndex(null)); + return ( + <Section onClick={() => handleMoreOptionsClick(row, col)} position='static'> + <MoreDarkIcon color={theme.iconColor?.groupSettings} /> + {selectedIndex?.length && selectedIndex[0] === row && ( + <DropdownContainer ref={dropdownRef} theme={theme}> + <Dropdown + dropdownValues={dropDownValues} + hoverBGColor={theme.backgroundColor?.modalHoverBackground} + /> + </DropdownContainer> + )} + </Section> + ); +}; + +const CriteriaSection = ({ criteria }: { criteria: ConditionData }) => { + const theme = useContext(ThemeContext); + + const getTokenNftComparisionLabel = () => { + return TOKEN_NFT_COMPARISION[ + criteria?.data?.['comparison'] as TokenNftComparision + ]; + }; + const checkIfNftToken = () => { + if ( + criteria?.category === CATEGORY.ERC721 || + criteria?.category === CATEGORY.ERC20 + ) + return true; + return false; + }; + + const getGuildRole = () =>{ + return (GUILD_COMPARISON_OPTIONS.find(option => option.value === criteria?.data?.['comparison']))?.heading; + + } + return ( + <Section gap="8px"> + <Span + alignSelf="center" + background="#657795" + borderRadius="4px" + fontSize="10px" + color={theme.textColor?.buttonText} + padding="4px 8px 4px 8px" + > + {CRITERIA_TYPE[criteria.category as CriteriaType]} + </Span> + {checkIfNftToken() && ( + <Span fontWeight="700" color={theme.textColor?.modalHeadingText}> + <Span fontWeight="500" color={theme.textColor?.modalSubHeadingText}> + {getTokenNftComparisionLabel()}{' '} + </Span> + {/* need to fetch token symbol */} + {criteria?.data?.['amount']} {criteria.category} + </Span> + )} + {criteria.category === CATEGORY.INVITE && ( + <Span fontWeight="500" color={theme.textColor?.modalSubHeadingText}> + Owner and Admin can invite + </Span> + )} + {criteria.category === CATEGORY.CustomEndpoint && ( + <Span + fontWeight="500" + fontSize="14px" + color={theme.textColor?.modalSubHeadingText} + > + {shortenText(criteria.data?.['url'],30)} + </Span> + )} + {criteria.category === CATEGORY.ROLES && ( + <Span fontWeight="700" color={theme.textColor?.modalHeadingText}> + {criteria?.data?.['id']} {' '} + <Span fontWeight="500" color={theme.textColor?.modalSubHeadingText}> + with {' '} + </Span> + {getGuildRole()} role + </Span> + )} + </Section> + ); +}; +// fix dropdown ui +const ConditionsComponent = ({ + conditionData, + deleteFunction, + updateFunction, + moreOptions = true, +}: CriteriaProps) => { + const [selectedIndex, setSelectedIndex] = useState<Array<number> | null>( + null + ); + + const dropdownRef = useRef<any>(null); + + const dropDownValues: DropdownValueType[] = [ + { + id: 0, + value: 'Edit', + title: 'Edit', + icon: EditSvg, + function: () => { + if (updateFunction) { + if (selectedIndex) { + updateFunction(selectedIndex[0]); + setSelectedIndex(null); + } + } + }, + }, + { + id: 1, + value: 'Remove', + title: 'Remove', + icon: RemoveSvg, + function: () => { + if (deleteFunction) { + if (selectedIndex) { + deleteFunction(selectedIndex[0]); + setSelectedIndex(null); + } + } + }, + }, + ]; + const theme = useContext(ThemeContext); + + useClickAway(dropdownRef, () => setSelectedIndex(null)); + + const handleMoreOptionsClick = (row: number, col: number) => { + setSelectedIndex([row, col]); + }; + + return ( + <Section flexDirection="column" width="100%" height="100%"> + {conditionData && + conditionData.slice(1).map((criteria, row) => ( + <Section flexDirection="column" > + {criteria.length <= 2 && + criteria.length >= 1 && + criteria.map((singleCriteria, col) => ( + <> + {singleCriteria.type && ( + <Section + borderRadius={theme.borderRadius?.modalInnerComponents} + background={theme.backgroundColor?.modalHoverBackground} + padding="10px 4px 10px 12px" + justifyContent="space-between" + > + <CriteriaSection criteria={singleCriteria} /> + {moreOptions && ( + <MoreOptionsContainer + handleMoreOptionsClick={handleMoreOptionsClick} + row={row} + col={col} + dropDownValues={dropDownValues} + setSelectedIndex={setSelectedIndex} + selectedIndex={selectedIndex} + /> + )} + </Section> + )} + </> + ))} + + {criteria[0]?.operator && criteria.length > 2 && ( + <CriteriaGroup + theme={theme} + flexDirection="row" + justifyContent="space-between" + alignItems="center" + borderRadius={theme.borderRadius?.modalInnerComponents} + padding="8px 0px 8px 8px" + gap="25px" + > + <Section flexDirection="column" gap="8px" width="100%"> + {criteria.map((singleCriteria, col) => ( + <> + {singleCriteria.type && ( + <> + <Section + borderRadius={ + theme.borderRadius?.modalInnerComponents + } + background={ + theme.backgroundColor?.modalHoverBackground + } + padding="10px 4px 10px 12px" + justifyContent="space-between" + width="100%" + > + <CriteriaSection criteria={singleCriteria} /> + </Section> + </> + )} + </> + ))} + </Section> + <Section + > + {criteria.map((singleCriteria) => ( + <> + {criteria.length > 2 && + singleCriteria.operator && + !singleCriteria.type && ( + <OperatorSpan theme={theme}> + {singleCriteria.operator} + </OperatorSpan> + )} + </> + ))} + {moreOptions && ( + <MoreOptionsContainer + handleMoreOptionsClick={handleMoreOptionsClick} + row={row} + col={0} + dropDownValues={dropDownValues} + setSelectedIndex={setSelectedIndex} + selectedIndex={selectedIndex} + /> + )} + </Section> + </CriteriaGroup> + )} + {conditionData && + row < conditionData.length - 2 && + conditionData[0][0]?.operator && ( + // this can be reused + <OperatorSpan theme={theme} zIndex="-2"> + {conditionData[0][0].operator} + </OperatorSpan> + )} + </Section> + ))} + </Section> + ); +}; + +export default ConditionsComponent; + +const DropdownContainer = styled.div` + position: absolute; + // left: 48%; + top: 0; + right: 0; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + + padding: 6px 32px 6px 12px; + z-index: 999999999999 !important; + display: flex; + flex-direction: column !important; + background: ${(props) => props.theme.backgroundColor.modalBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; +`; + +const OperatorSpan = styled(Span)<{ theme: IChatTheme }>` + padding: 4px 8px; + margin: 8px 0; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + background: ${(props) => props.theme.backgroundColor.modalHoverBackground}; + color: ${(props) => props.theme.textColor?.modalSubHeadingText}; +`; + +const CriteriaGroup = styled(Section)<{ theme: IChatTheme }>` + border: ${(props) => props.theme.border?.modalInnerComponents}; +`; diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx new file mode 100644 index 000000000..9b2ad7045 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupModal.tsx @@ -0,0 +1,341 @@ +import React, { useContext, useEffect, useRef, useState } from 'react'; + +import styled from 'styled-components'; +import { ToastContainer } from 'react-toastify'; +import { AiTwotoneCamera } from 'react-icons/ai'; +import { MdError } from 'react-icons/md'; + +import { ModalHeader } from '../reusables/Modal'; +import { Modal } from '../reusables/Modal'; +import { TextInput } from '../reusables/TextInput'; +import { TextArea } from '../reusables/TextArea'; +import { Section, Span } from '../../reusables'; +import { Button } from '../reusables'; +import { CreateGroupType } from './CreateGroupType'; +import useToast from '../reusables/NewToast'; +import { CreateGroupModalProps, IChatTheme } from '../exportedTypes'; +import useMediaQuery from '../../../hooks/useMediaQuery'; +import { DefineCondtion } from './DefineCondition'; +import AddCriteria from './AddCriteria'; +import { SpamIcon } from '../../../icons/SpamIcon'; +import { ThemeContext } from '../theme/ThemeProvider'; +import { + CriteriaStateManagerType, + useCriteriaStateManager, +} from '../../../hooks/chat/useCriteriaState'; + +import { Image } from '../../../config/styles'; +import { ProfilePicture, device } from '../../../config'; + +export const CREATE_GROUP_STEP_KEYS = { + INPUT_DETAILS: 1, + GROUP_TYPE: 2, + DEFINITE_CONDITION: 3, + ADD_CRITERIA: 4, +} as const; + +export type CreateGroupStepKeys = + typeof CREATE_GROUP_STEP_KEYS[keyof typeof CREATE_GROUP_STEP_KEYS]; + +interface GroupInputDetailsType { + groupName: string; + groupDescription: string; + groupImage: string; +} + +export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({ + onClose, +}) => { + const [activeComponent, setActiveComponent] = useState<CreateGroupStepKeys>( + // replace it with info one + CREATE_GROUP_STEP_KEYS.INPUT_DETAILS + ); + + const handleNext = () => { + setActiveComponent((activeComponent + 1) as CreateGroupStepKeys); + }; + const handlePrevious = () => { + setActiveComponent((activeComponent - 1) as CreateGroupStepKeys); + }; + + const criteriaStateManager = useCriteriaStateManager(); + + useEffect(() => { + // reset update rules + if (activeComponent === 2) { + criteriaStateManager.resetRules(); + } else if (activeComponent === 3) { + criteriaStateManager.resetCriteriaIdx(); + } + }, [activeComponent]); + + const [groupInputDetails, setGroupInputDetails] = + useState<GroupInputDetailsType>({ + groupName: '', + groupDescription: '', + groupImage: '', + }); + + const renderComponent = () => { + switch (activeComponent) { + case CREATE_GROUP_STEP_KEYS.INPUT_DETAILS: + return ( + <CreateGroupDetail + criteriaStateManager={criteriaStateManager} + handleNext={handleNext} + onClose={onClose} + groupInputDetails={groupInputDetails} + setGroupInputDetails={setGroupInputDetails} + /> + ); + case CREATE_GROUP_STEP_KEYS.GROUP_TYPE: + return ( + <CreateGroupType + criteriaStateManager={criteriaStateManager} + groupInputDetails={groupInputDetails} + handleNext={handleNext} + onClose={onClose} + handlePrevious={handlePrevious} + /> + ); + case CREATE_GROUP_STEP_KEYS.DEFINITE_CONDITION: + return ( + <DefineCondtion + criteriaStateManager={criteriaStateManager} + handleNext={handleNext} + handlePrevious={handlePrevious} + onClose={onClose} + /> + ); + case CREATE_GROUP_STEP_KEYS.ADD_CRITERIA: + return ( + <AddCriteria + criteriaStateManager={criteriaStateManager} + handlePrevious={handlePrevious} + onClose={onClose} + /> + ); + default: + return ( + <CreateGroupDetail + criteriaStateManager={criteriaStateManager} + handlePrevious={handlePrevious} + onClose={onClose} + groupInputDetails={groupInputDetails} + setGroupInputDetails={setGroupInputDetails} + /> + ); + } + }; + + return ( + <Modal> + {renderComponent()} <ToastContainer /> + </Modal> + ); +}; + +export interface ModalHeaderProps { + handleNext?: () => void; + handlePrevious?: () => void; + onClose: () => void; + criteriaStateManager: CriteriaStateManagerType; +} + +interface GroupDetailState { + groupInputDetails: GroupInputDetailsType; + setGroupInputDetails: React.Dispatch< + React.SetStateAction<GroupInputDetailsType> + >; +} + +export interface GroupTypeState { + groupInputDetails: GroupInputDetailsType; +} + +const CreateGroupDetail = ({ + handleNext, + onClose, + groupInputDetails, + setGroupInputDetails, +}: ModalHeaderProps & GroupDetailState) => { + const groupInfoToast = useToast(); + const { groupName, groupDescription, groupImage } = groupInputDetails; + const theme = useContext(ThemeContext); + + const fileUploadInputRef = useRef<HTMLInputElement>(null); + const isMobile = useMediaQuery(device.mobileL); + + const handleChange = (e: Event) => { + if (!(e.target instanceof HTMLInputElement)) { + return; + } + if (!e.target.files) { + return; + } + if ( + (e.target as HTMLInputElement).files && + ((e.target as HTMLInputElement).files as FileList).length + ) { + const reader = new FileReader(); + reader.readAsDataURL(e.target.files[0]); + + reader.onloadend = function () { + setGroupInputDetails({ + groupDescription, + groupName, + groupImage: reader.result as string, + }); + }; + } + }; + + const showError = (errorMessage: string) => { + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: errorMessage, + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + }; + + const verifyAndHandelNext = () => { + const skipVerify = false; + + if (!skipVerify) { + // verify name + if (groupName.trim().length === 0) { + showError('Group Name is empty'); + return; + } + + // verify description + if (groupDescription.trim().length === 0) { + showError('Group Description is empty'); + return; + } + + // verify description + // if (!groupImage) { + // showError("Group image can't be empty"); + // return; + // } + } + + if (handleNext) { + handleNext(); + } + }; + + const handleUpload = () => { + if (fileUploadInputRef.current) { + fileUploadInputRef.current.click(); + } + }; + + //groupImage and desccription is optional + return ( + <Section + flexDirection="column" + alignItems="center" + gap="20px" + width={!isMobile ? '400px' : '300px'} + > + <ModalHeader title="Create Group" handleClose={onClose} /> + + <UploadContainer onClick={handleUpload}> + {!groupImage && ( + <ImageContainer theme={theme}> + <AiTwotoneCamera fontSize={40} color={'rgba(87, 93, 115, 1)'} /> + </ImageContainer> + )} + {groupImage && ( + <UpdatedImageContainer> + <Image + src={groupImage} + objectFit="contain" + alt="group image" + width="100%" + height="100%" + /> + </UpdatedImageContainer> + )} + <FileInput + type="file" + accept="image/*" + className="hidden" + ref={fileUploadInputRef} + onChange={(e) => handleChange(e as unknown as Event)} + /> + </UploadContainer> + <TextInput + labelName="Group Name" + charCount={30} + inputValue={groupName} + onInputChange={(e: any) => + setGroupInputDetails({ + groupDescription, + groupName: e.target.value, + groupImage, + }) + } + /> + + <TextArea + labelName="Group Description" + charCount={80} + inputValue={groupDescription} + onInputChange={(e: any) => + setGroupInputDetails({ + groupDescription: e.target.value, + groupName, + groupImage, + }) + } + /> + <Button width="197px" onClick={verifyAndHandelNext}> + Next + </Button> + </Section> + ); +}; + +export const GatingRulesInformation = () => { + const theme = useContext(ThemeContext); + return ( + <Section gap="6px" zIndex="-1"> + <SpamIcon /> + <Span color={theme.textColor?.modalSubHeadingText} fontSize="15px"> + Learn more about gating rules + </Span> + </Section> + ); +}; + +//use the theme +const UploadContainer = styled.div` + width: fit-content; + cursor: pointer; + align-self: center; +`; + +const ImageContainer = styled.div<{ theme: IChatTheme }>` + margin-top: 10px; + width: fit-content; + cursor: pointer; + border-radius: 32px; + background: ${(props) => props.theme.backgroundColor.modalHoverBackground}; + padding: 40px; +`; +const UpdatedImageContainer = styled.div` + margin-top: 10px; + width: 112px; + cursor: pointer; + height: 112px; + overflow: hidden; + border-radius: 32px; +`; + +const FileInput = styled.input` + display: none; +`; diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupType.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupType.tsx new file mode 100644 index 000000000..44ea24006 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/CreateGroupType.tsx @@ -0,0 +1,275 @@ +import { useContext, useState } from 'react'; + +import { MdCheckCircle, MdError } from 'react-icons/md'; +import styled from 'styled-components'; + +import { ModalHeader } from '../reusables/Modal'; +import OptionButtons, { OptionDescription } from '../reusables/OptionButtons'; +import { Section, Span, Spinner } from '../../reusables'; +import { ToggleInput } from '../reusables'; +import { Button } from '../reusables'; +import { GatingRulesInformation, ModalHeaderProps } from './CreateGroupModal'; +import { GroupTypeState } from './CreateGroupModal'; +import { ThemeContext } from '../theme/ThemeProvider'; +import useToast from '../reusables/NewToast'; +import { + ConditionType, + CriteriaStateType, +} from '../types/tokenGatedGroupCreationType'; +import ConditionsComponent from './ConditionsComponent'; +import { OperatorContainer } from './OperatorContainer'; +import { SelectedCriteria } from '../../../hooks/chat/useCriteriaState'; +import { useCreateGatedGroup } from '../../../hooks/chat/useCreateGatedGroup'; +import { GrouInfoType as GroupInfoType } from '../types'; + +import { ACCESS_TYPE_TITLE } from '../constants'; +import { IChatTheme } from '../exportedTypes'; +import { ProfilePicture } from '../../../config'; + +const GROUP_TYPE_OPTIONS: Array<OptionDescription> = [ + { + heading: 'Open', + subHeading: 'Anyone can join', + value: 'open', + }, + { + heading: 'Encrypted', + subHeading: 'Users must join group to view', + value: 'encrypted', + }, +]; + +interface AddConditionProps { + heading: string; + subHeading: string; + handleNext?: () => void; + criteriaState: CriteriaStateType; +} + +const AddConditionSection = ({ + heading, + subHeading, + handleNext, + criteriaState, +}: AddConditionProps) => { + const theme = useContext(ThemeContext); + + const generateMapping = () => { + return criteriaState.entryOptionsDataArray.map((rule, idx) => [ + { operator: criteriaState.entryOptionTypeArray[idx] }, + ...rule.map((el) => el), + ]); + }; + + return ( + <Section alignItems="start" flexDirection="column" gap="10px"> + <Section flexDirection="column" alignItems="start" gap="5px"> + <Span + color={theme.textColor?.modalHeadingText} + fontSize="16px" + fontWeight="500" + > + {heading} + </Span> + <Span + color={theme.textColor?.modalSubHeadingText} + fontWeight="400" + fontSize="12px" + > + {subHeading} + </Span> + </Section> + + {criteriaState.entryOptionsDataArray.length > 1 && ( + <Section margin="20px 0 10px 0"> + <OperatorContainer + operator={criteriaState.entryRootCondition} + setOperator={(newEl: string) => { + criteriaState.setEntryRootCondition(newEl as ConditionType); + }} + /> + </Section> + )} + <ConditionSection + width="100%" + overflow="hidden auto" + maxHeight="20rem" + theme={theme} + padding="5px 4px 5px 0" + > + <ConditionsComponent + conditionData={[ + [{ operator: criteriaState.entryRootCondition }], + ...generateMapping(), + ]} + deleteFunction={(idx) => { + criteriaState.deleteEntryOptionsDataArray(idx); + }} + updateFunction={(idx) => { + criteriaState.selectEntryOptionsDataArrayForUpdate(idx); + if (handleNext) { + handleNext(); + } + }} + /> + </ConditionSection> + + <Button + onClick={() => { + if (handleNext) { + criteriaState.setSelectedRule([]); + criteriaState.setSelectedCriteria(-1); + handleNext(); + } + }} + customStyle={{ + color: `${theme.backgroundColor?.buttonBackground}`, + fontSize: '15px', + fontWeight: '500', + border: `${theme.border?.modalInnerComponents}`, + background: 'transparent', + }} + > + + Add conditions + </Button> + </Section> + ); +}; + +export const CreateGroupType = ({ + onClose, + handlePrevious, + groupInputDetails, + handleNext, + criteriaStateManager, +}: ModalHeaderProps & GroupTypeState) => { + const [checked, setChecked] = useState<boolean>(true); + const [groupEncryptionType, setGroupEncryptionType] = useState( + GROUP_TYPE_OPTIONS[0].value + ); + + const { createGatedGroup, loading } = useCreateGatedGroup(); + const groupInfoToast = useToast(); + + const getEncryptionType = () =>{ + if(groupEncryptionType === "encrypted"){ + return false + } + return true + } + + const createGroupService = async () => { + const groupInfo:GroupInfoType = { + groupName:groupInputDetails.groupName, + groupDescription:groupInputDetails.groupDescription, + groupImage:groupInputDetails.groupImage || ProfilePicture, + isPublic: getEncryptionType(), + }; + const rules: any = checked ? criteriaStateManager.generateRule() : {}; + const isSuccess = await createGatedGroup(groupInfo, rules); + if(isSuccess === true){ + groupInfoToast.showMessageToast({ + toastTitle: 'Success', + toastMessage: 'Group created successfully', + toastType: 'SUCCESS', + getToastIcon: (size) => <MdCheckCircle size={size} color="green" />, + }); + }else{ + showError('Group creation failed'); + } + + onClose(); + }; + + const verifyAndCreateGroup = async () => { + if (groupEncryptionType.trim() === '') { + showError('Group encryption type is not selected'); + return; + } + + await createGroupService(); + }; + + const showError = (errorMessage: string) => { + groupInfoToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: errorMessage, + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + }; + + return ( + <Section flexDirection="column" gap="32px"> + <ModalHeader + title="Create Group" + handleClose={onClose} + handlePrevious={handlePrevious} + /> + <OptionButtons + options={GROUP_TYPE_OPTIONS} + selectedValue={groupEncryptionType} + handleClick={(newEl: string) => { + setGroupEncryptionType(newEl); + }} + /> + + <ToggleInput + labelHeading="Gated Group" + labelSubHeading="Turn this on for Token/NFT gating options" + checked={checked} + onToggle={() => setChecked(!checked)} + /> + + {checked && ( + <Section flexDirection="column" gap="32px"> + <AddConditionSection + criteriaState={criteriaStateManager.entryCriteria} + handleNext={() => { + if (handleNext) { + criteriaStateManager.setSelectedCriteria( + SelectedCriteria.ENTRY + ); + handleNext(); + } + }} + {...ACCESS_TYPE_TITLE.ENTRY} + /> + <AddConditionSection + handleNext={() => { + if (handleNext) { + criteriaStateManager.setSelectedCriteria(SelectedCriteria.CHAT); + handleNext(); + } + }} + criteriaState={criteriaStateManager.chatCriteria} + {...ACCESS_TYPE_TITLE.CHAT} + /> + </Section> + )} + + <Section gap="20px" flexDirection="column"> + <Button width="197px" onClick={verifyAndCreateGroup}> + {!loading && 'Create Group'} + {loading && <Spinner size="20" color="#fff" />} + </Button> + <GatingRulesInformation /> + </Section> + </Section> + ); +}; + +//styles +const ConditionSection = styled(Section)<{ theme: IChatTheme }>` + &::-webkit-scrollbar-thumb { + background: ${(props) => props.theme.scrollbarColor}; + border-radius: 10px; + } + &::-webkit-scrollbar-button { + height: 40px; + } + + &::-webkit-scrollbar { + width: 4px; + } +`; diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/DefineCondition.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/DefineCondition.tsx new file mode 100644 index 000000000..a0637bca1 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/DefineCondition.tsx @@ -0,0 +1,159 @@ +import { useContext, useEffect, useState } from 'react'; + +import styled from 'styled-components'; + +import { Section, Span } from '../../reusables'; +import { Button, ModalHeader } from '../reusables'; +import { AddButtons } from './AddButtons'; +import { ModalHeaderProps } from './CreateGroupModal'; +import { ThemeContext } from '../theme/ThemeProvider'; +import { GatingRulesInformation } from './CreateGroupModal'; +import useMediaQuery from '../../../hooks/useMediaQuery'; +import ConditionsComponent from './ConditionsComponent'; +import { OperatorContainer } from './OperatorContainer'; +import { handleDefineCondition } from '../helpers/tokenGatedGroup'; +import { IChatTheme } from '../theme'; + +import { device } from '../../../config'; +import { OPERATOR_OPTIONS_INFO } from '../constants'; + + +export const DefineCondtion = ({ + onClose, + handlePrevious, + handleNext, + criteriaStateManager, +}: ModalHeaderProps) => { + const theme = useContext(ThemeContext); + + const [isCriteriaAdded, setIsCriteriaAdded] = useState<boolean>(true); + const isMobile = useMediaQuery(device.mobileL); + + const criteriaState = criteriaStateManager.getSelectedCriteria(); + + const customButtonStyle = { + background: (criteriaState.selectedRules.length<1 ) + ? theme.backgroundColor?.buttonDisableBackground + : theme.backgroundColor?.buttonBackground, + color: (criteriaState.selectedRules.length<1 ) + ? theme.textColor?.buttonDisableText + : theme.textColor?.buttonText, + }; + + const verifyAndDoNext = () => { + handleDefineCondition(criteriaState, handlePrevious); + }; + + const getRules = () => { + return [ + [{ operator: criteriaState.entryRuleTypeCondition }], + ...criteriaState.selectedRules.map((el) => [el]), + ]; + }; + + // set state for edit condition + useEffect(() => { + if (criteriaState.isCondtionUpdateEnabled()) { + criteriaState.setEntryRuleTypeCondition( + criteriaState.entryOptionTypeArray[ + criteriaState.entryOptionsDataArrayUpdate + ] + ); + + if (criteriaState.selectedRules.length === 0) { + criteriaState.setSelectedRule([ + ...criteriaState.entryOptionsDataArray[ + criteriaState.entryOptionsDataArrayUpdate + ], + ]); + } + } else { + // + } + }, []); + + return ( + <Section + flexDirection="column" + gap="20px" + width={isMobile ? '300px' : '400px'} + > + <ModalHeader + title={ + criteriaState.isCondtionUpdateEnabled() + ? 'Update Condition' + : 'Define Condition' + } + handleClose={onClose} + handlePrevious={handlePrevious} + /> + {isCriteriaAdded && ( + <> + {criteriaState.selectedRules.length>1 && <Section margin="20px 0 10px 0"> + <OperatorContainer + operator={criteriaState.entryRuleTypeCondition} + setOperator={(newEl: string) => { + criteriaState.setEntryRuleTypeCondition( + newEl as keyof typeof OPERATOR_OPTIONS_INFO + ); + }} + /> + </Section>} + <ConditionSection + width="100%" + overflow="hidden auto" + maxHeight="20rem" + theme={theme} + padding="5px 4px 10px 0" + > + <ConditionsComponent + conditionData={getRules()} + deleteFunction={(idx) => { + criteriaState.deleteRule(idx); + }} + updateFunction={(idx) => { + criteriaState.setUpdateCriteriaIdx(idx); + if (handleNext) { + handleNext(); + } + }} + /> + </ConditionSection> + </> + )} + <Section flexDirection="column" gap="10px"> + <AddButtons handleNext={handleNext} title={'+ Add criteria'} /> + <Span + fontSize="15px" + fontWeight="400" + color={theme.textColor?.modalSubHeadingText} + > + You must add at least 1 criteria to enable gating + </Span> + </Section> + <Button + onClick={verifyAndDoNext} + customStyle={customButtonStyle} + width="158px" + > + {criteriaState.isCondtionUpdateEnabled() ? 'Update' : 'Add'} + </Button> + <GatingRulesInformation /> + </Section> + ); +}; + +const ConditionSection = styled(Section)<{ theme: IChatTheme }>` + &::-webkit-scrollbar-thumb { + background: ${(props) => props.theme.scrollbarColor}; + border-radius: 10px; + } + + &::-webkit-scrollbar-button { + height: 40px; + } + + &::-webkit-scrollbar { + width: 4px; + } +`; diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/OperatorContainer.tsx b/packages/uiweb/src/lib/components/chat/CreateGroup/OperatorContainer.tsx new file mode 100644 index 000000000..d038226c3 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/OperatorContainer.tsx @@ -0,0 +1,46 @@ +import { useContext } from 'react'; +import { Section, Span } from '../../reusables'; +import { OPERATOR_OPTIONS, OPERATOR_OPTIONS_INFO } from '../constants'; +import { OptionButtons } from '../reusables'; +import { ThemeContext } from '../theme/ThemeProvider'; + +interface OperatorContainerProps { + operator: string; + setOperator: any; + +} +export const OperatorContainer = ({ + operator, + setOperator, +}: OperatorContainerProps) => { + const theme = useContext(ThemeContext); + + + + return ( + <Section flexDirection="column" gap="16px"> + <OptionButtons + options={OPERATOR_OPTIONS} + selectedValue={operator} + handleClick={(newEl: string) => { + setOperator(newEl); + }} + /> + <Span fontSize="14px"> + { + OPERATOR_OPTIONS_INFO[ + operator as keyof typeof OPERATOR_OPTIONS_INFO + ]?.head + } + <Span color={theme.textColor?.modalSubHeadingText}> + {' '} + { + OPERATOR_OPTIONS_INFO[ + operator as keyof typeof OPERATOR_OPTIONS_INFO + ]?.tail + } + </Span> + </Span> + </Section> + ); +}; diff --git a/packages/uiweb/src/lib/components/chat/CreateGroup/index.ts b/packages/uiweb/src/lib/components/chat/CreateGroup/index.ts new file mode 100644 index 000000000..8ae8da2b4 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/CreateGroup/index.ts @@ -0,0 +1 @@ +export {CreateGroupModal} from "./CreateGroupModal"; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx b/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx index a1305be48..d9b9f091a 100644 --- a/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx +++ b/packages/uiweb/src/lib/components/chat/MessageInput/MessageInput.tsx @@ -1,291 +1,678 @@ -import { useChatData, useClickAway, useDeviceWidthCheck } from "../../../hooks"; -import type { FileMessageContent } from "../../../types"; -import type { ChatMainStateContextType } from "../../../context/chatAndNotification/chat/chatMainStateContext"; -import { ChangeEvent, useContext, useEffect, useRef, useState } from "react"; -import { GIFType, IChatTheme, MessageInputProps } from "../exportedTypes"; -import styled from "styled-components"; -import { PUBLIC_GOOGLE_TOKEN, device } from "../../../config"; -import { Section, Div, Span } from "../../reusables"; -import { EmojiIcon } from "../../../icons/Emoji"; -import EmojiPicker, { EmojiClickData } from "emoji-picker-react"; -import * as PUSHAPI from "@pushprotocol/restapi"; -import { GifIcon } from "../../../icons/Gif"; -import GifPicker from "gif-picker-react"; -import { AttachmentIcon } from "../../../icons/Attachment"; -import usePushSendMessage from "../../../hooks/chat/usePushSendMessage"; -import { SendCompIcon } from "../../../icons/SendCompIcon"; -import { Spinner } from "../../reusables"; -import { ThemeContext } from "../theme/ThemeProvider"; -import { ConnectButton } from "../ConnectButton"; +import { ChangeEvent, useContext, useEffect, useRef, useState } from 'react'; +import styled from 'styled-components'; +import { MdCheckCircle, MdError } from 'react-icons/md'; +import EmojiPicker, { EmojiClickData } from 'emoji-picker-react'; +import GifPicker from 'gif-picker-react'; +import { IFeeds } from '@pushprotocol/restapi'; +import { ToastContainer } from 'react-toastify'; + +import { Section, Div, Span } from '../../reusables'; +import { EmojiIcon } from '../../../icons/Emoji'; +import { GifIcon } from '../../../icons/Gif'; +import { AttachmentIcon } from '../../../icons/Attachment'; +import usePushSendMessage from '../../../hooks/chat/usePushSendMessage'; +import { SendCompIcon } from '../../../icons/SendCompIcon'; +import { Spinner } from '../../reusables'; +import { ThemeContext } from '../theme/ThemeProvider'; +import OpenLink from '../../../icons/OpenLink'; +import useVerifyAccessControl from '../../../hooks/chat/useVerifyAccessControl'; +import TokenGatedIcon from '../../../icons/Token-Gated.svg'; +import { Modal } from '../reusables/Modal'; +import { Image } from '../../reusables'; +import { ConnectButtonComp } from '../ConnectButton'; +import { + checkIfIntent, + getDefaultFeedObject, + getNewChatUser, + setAccessControl, +} from '../../../helpers'; +import useFetchChat from '../../../hooks/chat/useFetchChat'; +import useGetChatProfile from '../../../hooks/useGetChatProfile'; +import useGetGroup from '../../../hooks/chat/useGetGroup'; +import useApproveChatRequest from '../../../hooks/chat/useApproveChatRequest'; +import { + useChatData, + useClickAway, + useDeviceWidthCheck, + usePushChatSocket, +} from '../../../hooks'; + +import type { FileMessageContent } from '../../../types'; +import { GIFType, IChatTheme, MessageInputProps } from '../exportedTypes'; +import { PUBLIC_GOOGLE_TOKEN, device } from '../../../config'; +import { checkIfAccessVerifiedGroup, checkIfMember } from '../helpers'; +import useToast from '../reusables/NewToast'; /** * @interface IThemeProps * this interface is used for defining the props for styled components */ interface IThemeProps { - theme?: IChatTheme; + theme?: IChatTheme; } -export const MessageInput: React.FC<MessageInputProps> = ({ chatId, Emoji = true, GIF = true, File = true, isConnected = true }) => { - const [typedMessage, setTypedMessage] = useState<string>(""); - const [showEmojis, setShowEmojis] = useState<boolean>(false); - const [gifOpen, setGifOpen] = useState<boolean>(false); - const [newChat, setNewChat] = useState<boolean>(false); - const modalRef = useRef(null); - const fileUploadInputRef = useRef<HTMLInputElement>(null); - const [fileUploading, setFileUploading] = useState<boolean>(false); - const onChangeTypedMessage = (val: string) => { - setTypedMessage(val.trim()); - }; - const theme = useContext(ThemeContext); - const isMobile = useDeviceWidthCheck(425); - const { sendMessage, loading } = usePushSendMessage(); - const { pgpPrivateKey, setPgpPrivateKey } = useChatData(); - - useClickAway(modalRef, () => { - setShowEmojis(false); - setGifOpen(false); - }); - const textAreaRef = useRef<HTMLTextAreaElement>(null); - useEffect(() => { - if (textAreaRef?.current?.style) { - textAreaRef.current.style.height = 25 + 'px'; - const scrollHeight = textAreaRef.current?.scrollHeight; - textAreaRef.current.style.height = scrollHeight + 'px'; - } - }, [textAreaRef, typedMessage]) +const ConnectButtonSection = ({autoConnect}:{autoConnect:boolean}) => { + const { signer } = useChatData(); + return ( + <Section + width="100%" + justifyContent="space-between" + alignItems="center" + padding="8px" + > + {!signer && ( + <Span + padding="8px 8px 8px 16px" + color="#B6BCD6" + fontSize="15px" + fontWeight="400" + textAlign="start" + > + You need to connect your wallet to get started + </Span> + )} + <ConnectButtonComp autoConnect={autoConnect} /> + </Section> + ); +}; + +export const MessageInput: React.FC<MessageInputProps> = ({ + chatId, + emoji = true, + gif = true, + file = true, + isConnected = true, + autoConnect = false, + onGetTokenClick, +}) => { + const [typedMessage, setTypedMessage] = useState<string>(''); + const [showEmojis, setShowEmojis] = useState<boolean>(false); + const [gifOpen, setGifOpen] = useState<boolean>(false); + const modalRef = useRef(null); + const fileUploadInputRef = useRef<HTMLInputElement>(null); + const [fileUploading, setFileUploading] = useState<boolean>(false); + const [isRules, setIsRules] = useState<boolean>(false); + const [isMember, setIsMember] = useState<boolean>(false); + const { approveChatRequest, loading: approveLoading } = + useApproveChatRequest(); + const { acceptedRequestMessage, groupInformationSinceLastConnection } = + usePushChatSocket(); + const [chatFeed, setChatFeed] = useState<IFeeds>({} as IFeeds); + const theme = useContext(ThemeContext); + const isMobile = useDeviceWidthCheck(425); + const { sendMessage, loading } = usePushSendMessage(); + const { + verifyAccessControl, + setVerificationSuccessfull, + verificationSuccessfull, + verified, + setVerified, + loading: accessLoading, + } = useVerifyAccessControl(); + const { + account, + env, + connectedProfile, + setConnectedProfile, + pgpPrivateKey, + signer, + } = useChatData(); + const { fetchChat } = useFetchChat(); + const { fetchChatProfile } = useGetChatProfile(); + const { getGroup } = useGetGroup(); + const statusToast = useToast(); + const textAreaRef = useRef<HTMLTextAreaElement>(null); + + const onChangeTypedMessage = (val: string) => { + setTypedMessage(val); + }; + useClickAway(modalRef, () => { + setShowEmojis(false); + setGifOpen(false); + }); - const addEmoji = (emojiData: EmojiClickData, event: MouseEvent): void => { - setTypedMessage(typedMessage + emojiData.emoji); - setShowEmojis(false); + useEffect(() => { + if (textAreaRef?.current?.style) { + textAreaRef.current.style.height = 25 + 'px'; + const scrollHeight = textAreaRef.current?.scrollHeight; + textAreaRef.current.style.height = scrollHeight + 'px'; } + }, [textAreaRef, typedMessage]); - const handleUploadFile = () => { - if (fileUploadInputRef.current) { - fileUploadInputRef.current.click(); - } + //need to do something about fetching connectedUser in every component + useEffect(() => { + (async () => { + if (!connectedProfile && account) { + const user = await fetchChatProfile({ profileId: account!, env }); + if (user) setConnectedProfile(user); + } + })(); + }, [account]); + + useEffect(() => { + const storedTimestampJSON = localStorage.getItem(chatId); + + if (storedTimestampJSON) { + const storedTimestamp = JSON.parse(storedTimestampJSON); + const currentTimestamp = new Date().getTime(); + const twentyFourHoursInMilliseconds = 24 * 60 * 60 * 1000; + + if ( + Math.abs(currentTimestamp - storedTimestamp) < + twentyFourHoursInMilliseconds + ) { + setVerified(true); + } else { + setVerified(false); + setAccessControl(chatId, true); + } } + }, [chatId, verified, isMember, account, env]); - const uploadFile = async ( - e: ChangeEvent<HTMLInputElement> - ): Promise<void> => { - if (!(e.target instanceof HTMLInputElement)) { - return; - } - if (!e.target.files) { - return; - } - if ( - e.target && - (e.target as HTMLInputElement).files && - ((e.target as HTMLInputElement).files as FileList).length - ) { - const file: File = e.target.files[0]; - if (file) { - try { - const TWO_MB = 1024 * 1024 * 2; - if (file.size > TWO_MB) { - console.log('Files larger than 2mb is now allowed'); - throw new Error('Files larger than 2mb is now allowed'); - } - setFileUploading(true); - const messageType = file.type.startsWith('image') ? 'Image' : 'File'; - const reader = new FileReader(); - let fileMessageContent: FileMessageContent; - reader.readAsDataURL(file); - reader.onloadend = async (e): Promise<void> => { - fileMessageContent = { - content: e.target!.result as string, - name: file.name, - type: file.type, - size: file.size, - }; - - sendPushMessage(JSON.stringify(fileMessageContent), messageType); - }; - } catch (err) { - console.log(err); - } finally { - setFileUploading(false); - } + useEffect(() => { + if (Object.keys(groupInformationSinceLastConnection || {}).length) { + if ( + chatFeed?.groupInformation?.chatId.toLowerCase() === + groupInformationSinceLastConnection.chatId.toLowerCase() + ) { + const updateChatFeed = chatFeed; + updateChatFeed.groupInformation = groupInformationSinceLastConnection; + setChatFeed(updateChatFeed); + } + } + }, [groupInformationSinceLastConnection]); + + useEffect(() => { + (async () => { + if ( + Object.keys(acceptedRequestMessage || {}).length && + Object.keys(chatFeed || {}).length + ) { + await updateChatFeed(); + } + })(); + }, [acceptedRequestMessage]); + + //need to makea common method for fetching chatFeed to ruse in messageInput + useEffect(() => { + (async () => { + if (!account && !env) return; + if (account && env) { + const chat = await fetchChat({ chatId }); + if (Object.keys(chat || {}).length) setChatFeed(chat as IFeeds); + else { + let newChatFeed; + let group; + const result = await getNewChatUser({ + searchText: chatId, + fetchChatProfile, + env, + }); + if (result) { + newChatFeed = getDefaultFeedObject({ user: result }); + } else { + group = await getGroup({ searchText: chatId }); + if (group) { + newChatFeed = getDefaultFeedObject({ groupInformation: group }); } + } + if (newChatFeed) { + setChatFeed(newChatFeed); + } } - }; + } + })(); + }, [chatId, pgpPrivateKey, account, env]); - const sendPushMessage = async (content: string, type: string) => { - try { - await sendMessage({ - message: content, - chatId, - messageType: type as any, - }); - } catch (error) { - console.log(error); - } + useEffect(() => { + console.log('in useEffect') + console.log(chatFeed) + if (!account && !env && !chatId) return; + if (account && env && chatId && chatFeed && chatFeed?.groupInformation) { + console.log('inside condition') + setIsMember(checkIfMember(chatFeed, account)); + setIsRules(checkIfAccessVerifiedGroup(chatFeed)); + } + }, [chatId, chatFeed, account, env]); +console.log(isMember) +console.log(checkIfMember(chatFeed, account!)) + const addEmoji = (emojiData: EmojiClickData, event: MouseEvent): void => { + setTypedMessage(typedMessage + emojiData.emoji); + setShowEmojis(false); + }; + + const handleUploadFile = () => { + if (fileUploadInputRef.current) { + fileUploadInputRef.current.click(); } + }; - const sendTextMsg = async () => { - if (typedMessage.trim() !== '') { - await sendPushMessage(typedMessage as string, 'Text'); - setTypedMessage(''); + const checkVerification = () => { + verifyAccessControl({ chatId, did: account! }); + }; + + const handleJoinGroup = async () => { + if (chatFeed && chatFeed?.groupInformation?.isPublic) { + const response = await approveChatRequest({ + chatId, + }); + if (response) { + await updateChatFeed();} + } else { + const sendTextMessage = await sendMessage({ + message: `Hello, please let me join this group, my wallet address is ${account}`, + chatId: chatFeed?.groupInformation?.groupCreator || '', + messageType: 'Text', + }); + if (sendTextMessage) { + statusToast.showMessageToast({ + toastTitle: 'Success', + toastMessage: 'Request sent successfully', + toastType: 'SUCCESS', + getToastIcon: (size) => <MdCheckCircle size={size} color="green" />, + }); + } else { + statusToast.showMessageToast({ + toastTitle: 'Error', + toastMessage: 'Unable to send request', + toastType: 'ERROR', + getToastIcon: (size) => <MdError size={size} color="red" />, + }); + } + } + }; + + const uploadFile = async ( + e: ChangeEvent<HTMLInputElement> + ): Promise<void> => { + if (!(e.target instanceof HTMLInputElement)) { + return; + } + if (!e.target.files) { + return; + } + if ( + e.target && + (e.target as HTMLInputElement).files && + ((e.target as HTMLInputElement).files as FileList).length + ) { + const file: File = e.target.files[0]; + if (file) { + try { + const TWO_MB = 1024 * 1024 * 2; + if (file.size > TWO_MB) { + console.log('Files larger than 2mb is now allowed'); + throw new Error('Files larger than 2mb is now allowed'); + } + setFileUploading(true); + const messageType = file.type.startsWith('image') ? 'Image' : 'File'; + const reader = new FileReader(); + let fileMessageContent: FileMessageContent; + reader.readAsDataURL(file); + reader.onloadend = async (e): Promise<void> => { + fileMessageContent = { + content: e.target!.result as string, + name: file.name, + type: file.type, + size: file.size, + }; + + sendPushMessage(JSON.stringify(fileMessageContent), messageType); + }; + } catch (err) { + console.log(err); + } finally { + setFileUploading(false); } + } } + }; + + const isJoinGroup = () => { + return !!pgpPrivateKey && !isMember; + }; - // useEffect(() => { - // setPgpPrivateKey - // }, [pgpPrivateKey]) + const isNotVerified = () => { + return !!pgpPrivateKey && !verified && isMember && isRules; + }; - const sendGIF = async (emojiObject: GIFType) => { - sendPushMessage(emojiObject.url as string, 'GIF'); - setGifOpen(false); + const sendPushMessage = async (content: string, type: string) => { + try { + const sendMessageResponse = await sendMessage({ + message: content, + chatId, + messageType: type as any, + }); + if ( + sendMessageResponse && + typeof sendMessageResponse === 'string' && + sendMessageResponse.includes('403') + ) { + setAccessControl(chatId, true); + setVerified(false); + setVerificationSuccessfull(false); + } + } catch (error) { + console.log(error); } + }; - return ( - <Container theme={theme}> - {/* {isConnected && ( - <ConnectButton /> - )} */} - <TypebarSection - // zIndex="1" - borderRadius="13px" - padding={` ${pgpPrivateKey ? '13px 16px' : ''}`} - background={`${theme.bgColorPrimary}`} - alignItems="center" - justifyContent="space-between" - > - {!pgpPrivateKey && isConnected && ( - // align this button in right corner + const sendTextMsg = async () => { + if (typedMessage.trim() !== '') { + await sendPushMessage(typedMessage as string, 'Text'); + setTypedMessage(''); + } + }; - <Section width="100%" justifyContent="space-between" alignItems="center" - > - <Span padding="8px 8px 8px 16px" color="#B6BCD6" fontSize="15px" fontWeight="400" textAlign="start"> - You need to connect your wallet to get started - </Span> - <ConnectButton /> - </Section> - ) + const sendGIF = async (emojiObject: GIFType) => { + sendPushMessage(emojiObject.url as string, 'GIF'); + setGifOpen(false); + }; + + const updateChatFeed = async () => { + + const chat = await fetchChat({ chatId }); + + if (Object.keys(chat || {}).length) { + + setChatFeed(chat as IFeeds); + } + }; + + return !Object.keys(chatFeed || {}).length ? ( + <> + {!pgpPrivateKey && (isConnected || !!signer) && ( + <TypebarSection + width="100%" + overflow="hidden" + borderRadius="13px" + position="static" + padding={` ${pgpPrivateKey ? '13px 16px' : ''}`} + background={`${theme.backgroundColor?.messageInputBackground}`} + alignItems="center" + justifyContent="space-between" + > + <ConnectButtonSection autoConnect={autoConnect}/> + </TypebarSection> + )} + </> + ) : !checkIfIntent({ chat: chatFeed, account: account! }) && + Object.keys(chatFeed || {}).length ? ( + <TypebarSection + width="100%" + overflow="hidden" + borderRadius={theme.borderRadius?.messageInput} + position="static" + border={theme.border?.messageInput} + padding={` ${pgpPrivateKey ? '13px 16px' : ''}`} + background={`${theme.backgroundColor?.messageInputBackground}`} + alignItems="center" + justifyContent="space-between" + > + {Object.keys(chatFeed || {}).length && chatFeed?.groupInformation ? ( + <> + {(isJoinGroup() || isNotVerified()) && ( + <Section + width="100%" + justifyContent="space-between" + alignItems="center" + > + <Span + padding="8px 8px 8px 16px" + color={theme.textColor?.chatReceivedBubbleText} + fontSize="15px" + fontWeight="500" + textAlign="start" + > + {isJoinGroup() && 'Click on the button to join the group'} + {isNotVerified() && ( + <> + Sending messages requires{' '} + <Span color={theme.backgroundColor?.chatSentBubbleBackground}> + 1 PUSH Token + </Span>{' '} + for participation.{' '} + <Link + href="https://docs.push.org/developers/developer-tooling/push-sdk/sdk-packages-details/epnsproject-sdk-restapi/for-chat/group-chat#to-create-a-token-gated-group" + target="_blank" + color={theme.backgroundColor?.chatSentBubbleBackground} + > + Learn More <OpenLink /> + </Link> + </> + )} + </Span> + <ConnectWrapper> + <Connect + onClick={async() => + isJoinGroup() ? await handleJoinGroup() : await checkVerification() } - {pgpPrivateKey && - <> - <Section gap="8px" flex="1"> - {Emoji && - <Div - width="20px" - cursor="pointer" - height="20px" - alignSelf="end" - onClick={() => setShowEmojis(!showEmojis)} - > - <EmojiIcon /> - </Div> - } - {showEmojis && ( - <Section - ref={modalRef} - position="absolute" - bottom="3.5rem" - left="2.7rem" - zIndex="1" - ><EmojiPicker - width={isMobile ? 260 : 320} - height={370} - onEmojiClick={addEmoji} - /> - </Section> - )} - <MultiLineInput - - theme={theme} - onKeyDown={(event) => { - if (event.key === 'Enter' && !event.shiftKey) { - event.preventDefault(); - sendTextMsg(); - } - }} - placeholder="Type your message..." - onChange={(e) => onChangeTypedMessage(e.target.value)} - value={typedMessage} - ref={textAreaRef} - rows={1} - /> - </Section> - <SendSection> - {GIF && - <Section - width="34px" - height="24px" - cursor="pointer" - alignSelf="end" - onClick={() => setGifOpen(!gifOpen)}> - <GifIcon /> - </Section> - } - {gifOpen && ( - <Section - position="absolute" - bottom="3.5rem" - zIndex="1" - right={isMobile ? '5rem' : '8rem'} - ref={modalRef}> - <GifPicker - onGifClick={sendGIF} - width={isMobile ? 260 : 320} - height={370} - tenorApiKey={String(PUBLIC_GOOGLE_TOKEN)} - /> - </Section> - )} - <Section onClick={handleUploadFile}> - {!fileUploading && File && ( - <> - <Section - width="17" - height="24px" - cursor="pointer" - alignSelf="end" - onClick={() => setNewChat(true)} - > - <AttachmentIcon /> - </Section> - <FileInput - type="file" - ref={fileUploadInputRef} - onChange={(e) => uploadFile(e)} - /> - </> - )} - </Section> - {!(loading || fileUploading) && ( - <Section - cursor="pointer" - alignSelf="end" - height="24px" - onClick={() => sendTextMsg()} - > - <SendCompIcon color={theme.accentBgColor} /> - </Section> - )} - - {(loading || fileUploading) && ( - <Section alignSelf="end" height="24px"> - <Spinner color={theme.accentBgColor} size="22" /> - </Section> - )} - </SendSection> - </> + > + {isJoinGroup() && + <> + {approveLoading ? ( + <Spinner color="#fff" size="24" /> + ) : ( + ' Join Group ' + )} + </> } - </TypebarSection> - </Container> - ) -} + {isNotVerified() && + <> + {accessLoading ? ( + <Spinner color="#fff" size="24" /> + ) : ( + 'Verify Access' + )} + </> + } + </Connect> + </ConnectWrapper> + </Section> + )} + {(!!pgpPrivateKey && !verificationSuccessfull) && ( + <Modal width="439px"> + <Section + padding="10px" + theme={theme} + gap="32px" + flexDirection="column" + > + <Span + fontWeight="500" + fontSize="24px" + color={theme.textColor?.encryptionMessageText} + > + Verification Failed + </Span> + <Span + color={theme.textColor?.encryptionMessageText} + fontSize="16px" + > + Please ensure the following conditions are met to participate and + send messages. + </Span> + <Section gap="8px" alignItems="start"> + <Image + verticalAlign="start" + height="24" + width="24" + src={TokenGatedIcon} + alt="token-gated" + /> + <Section flexDirection="column"> + {' '} + <Span + color={theme.textColor?.encryptionMessageText} + textAlign="start" + alignSelf="start" + > + Token Gated + </Span> + <Span + fontWeight="500" + textAlign="start" + color={theme.textColor?.encryptionMessageText} + > + You need to have{' '} + <Span color={theme.backgroundColor?.chatSentBubbleBackground}> + 1 PUSH Token + </Span>{' '} + in your wallet to be able to send messages. + </Span> + </Section> + </Section> + <Section gap="8px"> + <TokenWrapper + onClick={() => { + if (onGetTokenClick) { + onGetTokenClick(); + } + setVerificationSuccessfull(true); + }} + > + <TokenGet> + Get Free Tokens + <OpenLink height="12" width="12" /> + </TokenGet> + </TokenWrapper> + <ConnectWrapperClose + onClick={() => { + setVerificationSuccessfull(true); + }} + > + <ConnectClose>Close</ConnectClose> + </ConnectWrapperClose> + </Section> + </Section> + </Modal> + )} + </> + ) : null} + {!!pgpPrivateKey && + (((isRules ? verified : true) && isMember) || + (chatFeed && !chatFeed?.groupInformation)) && ( + <> + <Section gap="8px" flex="1" position="static"> + {emoji && ( + <Div + width="25px" + cursor="pointer" + height="25px" + alignSelf="end" + onClick={() => setShowEmojis(!showEmojis)} + > + <EmojiIcon color={theme.iconColor?.emoji} /> + </Div> + )} + {showEmojis && ( + <Section + ref={modalRef} + position="absolute" + bottom="2.5rem" + left="2.5rem" + zIndex="700" + > + <EmojiPicker + width={isMobile ? 260 : 320} + height={370} + onEmojiClick={addEmoji} + /> + </Section> + )} + <MultiLineInput + disabled={loading ? true : false} + theme={theme} + onKeyDown={(event) => { + if (event.key === 'Enter' && !event.shiftKey) { + event.preventDefault(); + sendTextMsg(); + } + }} + placeholder="Type your message..." + onChange={(e) => onChangeTypedMessage(e.target.value)} + value={typedMessage} + ref={textAreaRef} + rows={1} + /> + </Section> + <SendSection position="static"> + {gif && ( + <Section + width="34px" + height="24px" + cursor="pointer" + alignSelf="end" + onClick={() => setGifOpen(!gifOpen)} + > + <GifIcon /> + </Section> + )} + {gifOpen && ( + <Section + position="absolute" + bottom="2.5rem" + zIndex="1" + right={isMobile ? '7rem' : '8rem'} + ref={modalRef} + > + <GifPicker + onGifClick={sendGIF} + width={isMobile ? 260 : 320} + height={370} + tenorApiKey={String(PUBLIC_GOOGLE_TOKEN)} + /> + </Section> + )} + <Section onClick={handleUploadFile}> + {!fileUploading && file && ( + <> + <Section + width="17" + height="24px" + cursor="pointer" + alignSelf="end" + > + <AttachmentIcon color={theme.iconColor?.attachment} /> + </Section> + <FileInput + type="file" + ref={fileUploadInputRef} + onChange={(e) => uploadFile(e)} + /> + </> + )} + </Section> + {!(loading || fileUploading) && ( + <Section + cursor="pointer" + alignSelf="end" + height="24px" + onClick={() => sendTextMsg()} + > + <SendCompIcon color={theme.iconColor?.sendButton} /> + </Section> + )} -const Container = styled.div` - width: 100%; - overflow: hidden; -`; -const TypebarSection = styled(Section)` + {(loading || fileUploading) && ( + <Section alignSelf="end" height="24px"> + <Spinner color={theme.spinnerColor} size="22" /> + </Section> + )} + </SendSection> + </> + )} + <ToastContainer /> + </TypebarSection> + ) : ( + <></> + ); +}; + +const TypebarSection = styled(Section)<{ border?: string }>` gap: 10px; + border: ${(props) => props.border || 'none'}; @media ${device.mobileL} { gap: 0px; } @@ -304,9 +691,9 @@ const MultiLineInput = styled.textarea<IThemeProps>` outline: none; overflow-y: auto; box-sizing: border-box; - background:${(props) => props.theme.bgColorPrimary}; + background: ${(props) => props.theme.backgroundColor?.messageInputBackground}; border: none; - color: ${(props) => props.theme.textColorSecondary}; + color: ${(props) => props.theme.textColor?.messageInputText}; resize: none; flex: 1; padding-right: 5px; @@ -324,8 +711,8 @@ const MultiLineInput = styled.textarea<IThemeProps>` height: 50px; } ::placeholder { - color: ${(props) => props.theme.textColorSecondary}; - transform: translateY(1px); + color: ${(props) => props.theme.textColor?.messageInputText}; + transform: translateY(0px); @media ${device.mobileL} { font-size: 14px; } @@ -337,4 +724,94 @@ const MultiLineInput = styled.textarea<IThemeProps>` `; const FileInput = styled.input` display: none; -`; \ No newline at end of file +`; + +const ConnectWrapper = styled.div` + display: flex; + align-items: center; + flex-direction: column; + cursor: pointer; +`; + +const StyledButton = styled.button` + border: 0px; + outline: 0px; + padding: 24px 9px; + font-weight: 500; + border-radius: 12px; + font-size: 17px; + cursor: pointer; + width: 147px; + height: 44px; + text-align: start; + align-items: center; + display: flex; + justify-content: center; +`; + +const Connect = styled(StyledButton)` + color: rgb(255, 255, 255); + background: #d53a94; +`; + +const ConnectWrapperClose = styled.div` + display: flex; + align-items: center; + flex-direction: column; +`; + +const StyledButtonClose = styled.button` + border: 0px; + outline: 0px; + padding: 24px 9px; + font-weight: 500; + border-radius: 12px; + font-size: 17px; + cursor: pointer; + width: 147px; + height: 44px; + text-align: start; + align-items: center; + display: flex; + justify-content: center; +`; + +const ConnectClose = styled(StyledButtonClose)` + color: rgb(255, 255, 255); + background: #d53a94; + gap: 8px; +`; + +const TokenWrapper = styled.div` + display: flex; + align-items: center; + flex-direction: column; +`; + +const TokenStyledButton = styled.button` + border: 0px; + outline: 0px; + padding: 22px 9px; + font-weight: 500; + border-radius: 12px; + font-size: 17px; + cursor: pointer; + width: 100%; + height: 44px; + text-align: start; + align-items: center; + display: flex; + justify-content: center; +`; + +const TokenGet = styled(TokenStyledButton)` + color: #d53a94; + border: 2px solid #d53a94; + background: none; + gap: 8px; +`; +const Link = styled.a` + color: #d53a94; + link-decoration: none; + text-decoration: none; +`; diff --git a/packages/uiweb/src/lib/components/chat/constants/index.ts b/packages/uiweb/src/lib/components/chat/constants/index.ts new file mode 100644 index 000000000..4224f93ab --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/constants/index.ts @@ -0,0 +1,56 @@ +import { OptionDescription } from "../reusables"; + +export const INVITE_CHECKBOX_LABEL: { owner: string; admin: string } = { + owner: 'Only Owner can invite', + admin: 'Only Admin can invite', + }; + + export const GUILD_COMPARISON_OPTIONS: Array<OptionDescription> = [ + { + heading: 'ALL', + value: 'all', + }, + { + heading: 'ANY', + value: 'any', + }, + { + heading: 'SPECIFIC', + value: 'specific', + }, + ]; + + export const OPERATOR_OPTIONS = [ + { + heading: 'Any', + value: 'any', + }, + { + heading: 'All', + value: 'all', + } +] + + +export const OPERATOR_OPTIONS_INFO = { + any:{ + head:'Any one', + tail:'of the following criteria must be true' + }, + all:{ + head:'All', + tail:'of the following criteria must be true' + } +} ; + + +export const ACCESS_TYPE_TITLE = { + ENTRY: { + heading: 'Conditions to Join', + subHeading: 'Add a condition to join or leave it open for everyone', + }, + CHAT: { + heading: 'Conditions to Chat', + subHeading: 'Add a condition to join or leave it open for everyone', + }, +}; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/exportedTypes.ts b/packages/uiweb/src/lib/components/chat/exportedTypes.ts index 4da3d5691..26305646d 100644 --- a/packages/uiweb/src/lib/components/chat/exportedTypes.ts +++ b/packages/uiweb/src/lib/components/chat/exportedTypes.ts @@ -4,12 +4,14 @@ import { IGroup } from '../../types' export interface IChatViewListProps { chatId: string; + chatFilterList?: Array<string>; limit?: number; } export interface IChatViewComponentProps { messageInput?: boolean; chatViewList?: boolean; + chatFilterList?: Array<string>; chatProfile?: boolean; //name needs to change chatId: string; //need confirmation on this limit?: number; @@ -17,6 +19,8 @@ export interface IChatViewComponentProps { gif?: boolean; file?: boolean; isConnected?: boolean; + autoConnect?:boolean; + onGetTokenClick?: () => void; } export interface IChatProfile { @@ -34,15 +38,6 @@ export interface IToast { status: string; } -export type OptionProps = { - options: boolean; - setOptions: React.Dispatch<React.SetStateAction<boolean>>; - isGroup: boolean; - chatInfo: any; - groupInfo: IGroup | null | undefined , - setGroupInfo: React.Dispatch<React.SetStateAction<IGroup | null | undefined>>; - theme: IChatTheme; -} export type IMessagePayload = IMessageIPFS; export const CHAT_THEME_OPTIONS = { @@ -58,36 +53,16 @@ export type GIFType = { export interface MessageInputProps { chatId: string; - Emoji?: boolean; - GIF?: boolean; - File?: boolean; - Image?: boolean; + emoji?: boolean; + gif?: boolean; + file?: boolean; isConnected?: boolean; + autoConnect?:boolean; + onGetTokenClick?: () => void; } -export type UpdateGroupType = { - groupInfo: IGroup, - connectedUser: User, - adminList: Array<string>, - memberList: Array<string>, -} - -export type MemberListContainerType = { - key?: number; - memberData: User; - handleMemberList: (member: User) => void; - handleMembers?: (value: User[]) => void; - lightIcon: any; - darkIcon: any; - memberList?: any; -}; -export interface WalletProfileContainerProps { - id?: any; - background?: any; - border?: any; -}; export interface MessageIPFS { fromCAIP10: string @@ -138,10 +113,11 @@ export interface User { isAdmin?:boolean; } -export interface ShadowedProps { - setPosition: boolean; +export interface CreateGroupModalProps { + onClose: ()=>void; }; + export interface ModalButtonProps { memberListCount?: boolean; theme?: IChatTheme; @@ -150,3 +126,13 @@ export interface ModalButtonProps { export {IChatTheme} from './theme'; + +export interface ConditionData { + operator?: string; + type?: string; + category?: string; + subcategory?: string; + data?: Record<string, any>; +} + +export type ConditionArray = ConditionData[]; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/helpers/Modal.tsx b/packages/uiweb/src/lib/components/chat/helpers/Modal.tsx deleted file mode 100644 index c7cbef9b4..000000000 --- a/packages/uiweb/src/lib/components/chat/helpers/Modal.tsx +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @file Modal - * generic modal component for spaces UI - * does not handle any business logic, acts only as a container - */ -import { useRef, useContext } from 'react'; -import styled from 'styled-components' -import { ThemeContext } from '../theme/ThemeProvider'; -import { useClickAway } from '../../../hooks'; - -// import { ThemeContext } from '../theme/ThemeProvider'; - -// import { useClickAway } from '../../../hooks'; - -interface IModalProps { - width?: string; - clickawayClose?: () => void; - children: any; -} - -const ClickawayCloseModal = ({ children, clickawayClose, width }: IModalProps) => { - const modalRef = useRef(null); - const theme = useContext(ThemeContext) - - useClickAway(modalRef, () => { - if (clickawayClose) { - clickawayClose(); - } - }); - - return ( - <ModalParent ref={modalRef} width={width} theme={theme}> - {children} - </ModalParent> - ); -}; - -export const Modal = ({ clickawayClose, children, width }: IModalProps) => { - const theme = useContext(ThemeContext) - return ( - <ModalOverlay theme={theme}> - {clickawayClose ? ( - <ClickawayCloseModal clickawayClose={clickawayClose} width={width}>{children}</ClickawayCloseModal> - ) : ( - <ModalParent - width={width} - theme={theme} - > - { children } - </ModalParent> - )} - </ModalOverlay> - ); -}; - -/* styling */ - -const ModalOverlay = styled.div<IModalProps>` - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.4); /* Black with 40% opacity */ - display: flex; - color: ${props => props.theme.textColorPrimary ?? '#000'}; - justify-content: center; - align-items: center; - z-index: 2000; - - max-height: 100vh; - overflow-y: auto; - margin: auto !important; -`; - -const ModalParent = styled.div<IModalProps>` - // position: absolute; - // top: 50%; - // left: 50%; - // transform: translate(-50%, -50%); - - display: flex; - flex-direction: column; - align-items: center; - padding: 24px 20px; - - background: ${(props => props.theme.bgColorPrimary)}; - border-radius: 12px; - - width: ${(props => props.width ? props.width : 'auto')}; - margin: auto !important; - - @media (max-width: 425px) { - min-width: 300px; - max-width: 300px; - } -`; diff --git a/packages/uiweb/src/lib/components/chat/helpers/Toast.tsx b/packages/uiweb/src/lib/components/chat/helpers/Toast.tsx deleted file mode 100644 index 0411a0c6a..000000000 --- a/packages/uiweb/src/lib/components/chat/helpers/Toast.tsx +++ /dev/null @@ -1,190 +0,0 @@ -import { useState, useEffect, Fragment, useContext } from 'react'; -import styled, { keyframes } from 'styled-components'; -import { Image, Section } from '../../reusables'; -import CloseIcon from '../../../icons/close.svg'; -import { CheckCircleIcon } from '../../../icons/CheckCircle'; -import { ThemeContext } from '../theme/ThemeProvider'; -import { IChatTheme } from '../theme'; -import InfoIcon from '../../../icons/infodark.svg'; - - -type toastProps = { - toastMessage: string; - position?: string; - status: string; -} - -const Toast = ({ toastMessage, position, status }: toastProps) => { - const [message, setMessage] = useState(''); - const theme = useContext(ThemeContext); - - useEffect(() => { - setMessage(toastMessage); - - setTimeout(() => { - setMessage(''); - }, 5000); - }, [toastMessage]); - - const closeToast = () => { - setMessage(''); - } - if (message !== '') { - return ( - <Container> - <Notification - theme={theme} - status={status} - className={`toast ${position}`} > - - <NotificationImage> - {status === 'success' ? <CheckCircleIcon width='35px' height='35px' /> : <Image src={InfoIcon} width={'35px'} height='35px' />} - </NotificationImage> - - <Section flexDirection='column' alignItems='flex-start'> - <NotificationTitle theme={theme}>{status === 'success' ? 'Success' : 'Error'}</NotificationTitle> - <NotificationMessage theme={theme}> - {toastMessage} - </NotificationMessage> - </Section> - - <Button onClick={() => closeToast()}> - <Image src={CloseIcon} height="20px" maxHeight="20px" width={'auto'} cursor='pointer' /> - - </Button> - </Notification> - </Container> - ); - } else return null -} - - -const Container = styled.div` - position: fixed !important; - z-index: 999999; - width: 100vw; - top: 0; - left: 0; - height: 100vh; -`; - -const toastInRight = keyframes` - from { - transform: translateX(100%); - } - to { - transform: translateX(0); - } -`; - -const toastInLeft = keyframes` - from { - transform: translateX(-100%); - } - to { - transform: translateX(0); - } -`; - -const Notification = styled.div<{theme?: IChatTheme, status?: string}>` - background: ${(props) => props.status === 'success' ? props.theme.toastSuccessBackground : props.theme.toastErrorBackground}; - transition: .3s ease; - position: fixed; - pointer-events: auto; - overflow: hidden; - margin: 0 0 6px; - margin-bottom: 15px; - // width: 300px; - max-height: 100px; - border-radius: 16px; - box-shadow: 0 0 10px #999; - box-shadow: 10px 10px 10px ${(props) => props.theme.toastShadowColor}; - opacity: 1; - display: flex; - flex-direction: row; - gap: 10px; - - - &:hover { - box-shadow: 0 0 12px #fff; - opacity: 1; - cursor: pointer; - } - - &.toast { - height: fit-content; - width: fit-content; - padding: 20px 15px; - } - - &.top-right { - top: 20px; - right: 20px; - animation: ${toastInRight} .3s ease-in-out .3s both; - } - - &.bottom-right { - bottom: 20px; - right: 20px; - transition: transform .6s ease-in-out; - animation: ${toastInRight} .7s; - } - - &.top-left { - top: 20px; - left: 20px; - transition: transform .6s ease-in; - animation: ${toastInLeft} .7s; - } - - &.bottom-left { - bottom: 20px; - left: 20px; - transition: transform .6s ease-in; - animation: ${toastInLeft} .7s; - } -`; - - - -const NotificationImage = styled.div` -`; - -const NotificationTitle = styled.div` - font-weight: 700; - font-size: 16px; - text-align: left; - margin-top: 0; - margin-bottom: 5px; - min-width: 250px; - color: ${(props) => props.theme.textColorPrimary}; - -`; - -const NotificationMessage = styled.div` - margin: 0; - text-align: left; - white-space: nowrap; - color: ${(props) => props.theme.snackbarBorderText}; - - font-weight: 400; - font-size: 14px; -`; - -const Button = styled.div` - position: relative; - font-weight: 700; - color: #fff; - outline: none; - border: none; - text-shadow: 0 1px 0 #fff; - opacity: 1; - line-height: 1; - font-size: 16px; - padding: 0; - cursor: pointer; - background: 0 0; - border: 0; -`; - -export default Toast; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/helpers/group.ts b/packages/uiweb/src/lib/components/chat/helpers/group.ts new file mode 100644 index 000000000..2219e8200 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/helpers/group.ts @@ -0,0 +1,56 @@ +import { pCAIP10ToWallet } from '../../../helpers'; +import { IGroup } from '../../../types'; + +export const getAdminList = (groupInformation: IGroup): Array<string> => { + const adminsFromMembers = convertToWalletAddressList( + groupInformation?.members.filter((admin) => admin.isAdmin == true) + ); + const adminsFromPendingMembers = convertToWalletAddressList( + groupInformation?.pendingMembers.filter((admin) => admin.isAdmin == true) + ); + const adminList = [...adminsFromMembers, ...adminsFromPendingMembers]; + return adminList; +}; + +export const convertToWalletAddressList = ( + memberList: { wallet: string }[] +): string[] => { + return memberList ? memberList.map((member) => member.wallet) : []; +}; + +export const getUpdatedMemberList = ( + groupInfo: IGroup, + walletAddress: string +): Array<string> => { + const members = groupInfo?.members?.filter( + (i) => i.wallet?.toLowerCase() !== walletAddress?.toLowerCase() + ); + return convertToWalletAddressList([...members, ...groupInfo.pendingMembers]); +}; + +export const getUpdatedAdminList = ( + groupInfo: IGroup, + walletAddress: string | null, + toRemove: boolean +): Array<string> => { + const groupAdminList: any = getAdminList(groupInfo); + if (!toRemove) { + return [...groupAdminList, walletAddress]; + } else { + const newAdminList = groupAdminList.filter( + (wallet: any) => wallet.toLowerCase() !== walletAddress?.toLowerCase() + ); + return newAdminList; + } +}; + +export const isAccountOwnerAdmin = (groupInfo: IGroup, account: string) => { + if (account && groupInfo) { + return groupInfo?.members?.some( + (member) => + pCAIP10ToWallet(member?.wallet)?.toLowerCase() === + account?.toLowerCase() && member?.isAdmin + ); + } + return false; +}; diff --git a/packages/uiweb/src/lib/components/chat/helpers/helper.ts b/packages/uiweb/src/lib/components/chat/helpers/helper.ts index d4db16867..77899a9b0 100644 --- a/packages/uiweb/src/lib/components/chat/helpers/helper.ts +++ b/packages/uiweb/src/lib/components/chat/helpers/helper.ts @@ -2,34 +2,8 @@ import { IMessagePayload, User } from "../exportedTypes"; import { ethers } from "ethers"; import { IGroup } from "../../../types"; import { walletToPCAIP10 } from "../../../helpers"; +import { IFeeds } from "@pushprotocol/restapi"; -export const getAdminList = (groupInformation: IGroup): Array<string> => { - const adminsFromMembers = convertToWalletAddressList(groupInformation?.members.filter((admin) => admin.isAdmin == true)); - const adminsFromPendingMembers = convertToWalletAddressList(groupInformation?.pendingMembers.filter((admin) => admin.isAdmin == true)); - const adminList = [...adminsFromMembers,...adminsFromPendingMembers]; - return adminList - }; - -export const convertToWalletAddressList = ( - memberList: { wallet: string }[] - ): string[] => { - return memberList ? memberList.map((member) => member.wallet) : []; - } - -export const getUpdatedMemberList = (groupInfo: IGroup ,walletAddress:string): Array<string> =>{ - const members = groupInfo?.members?.filter((i) => i.wallet?.toLowerCase() !== walletAddress?.toLowerCase()); - return convertToWalletAddressList([...members,...groupInfo.pendingMembers]); -} - -export const getUpdatedAdminList = (groupInfo: IGroup, walletAddress: string | null, toRemove: boolean): Array<string> => { - const groupAdminList: any = getAdminList(groupInfo); - if (!toRemove) { - return [...groupAdminList, walletAddress]; - } else { - const newAdminList = groupAdminList.filter((wallet: any) => wallet !== walletAddress); - return newAdminList; - } - }; export const profilePicture = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==`; @@ -103,4 +77,33 @@ export const addWalletValidation = (member:User,memberList:any,groupMembers:any, export function isValidETHAddress(address: string) { return ethers.utils.isAddress(address); - } \ No newline at end of file + } + + export const checkIfMember = (chatFeed:IFeeds,account:string) => { + const members = chatFeed?.groupInformation?.members || []; + const pendingMembers = chatFeed?.groupInformation?.pendingMembers || []; + const allMembers = [...members, ...pendingMembers]; + let isMember = false; + allMembers.forEach((acc) => { + if ( + acc.wallet.toLowerCase() === walletToPCAIP10(account!).toLowerCase() + ) { + isMember = true; + } + }); + + + return isMember; + }; + + export const checkIfAccessVerifiedGroup = (chatFeed:IFeeds) => { + let isRules = false; + if ( + chatFeed?.groupInformation?.rules && + (chatFeed?.groupInformation?.rules?.entry || + chatFeed?.groupInformation?.rules?.chat) + ) { + isRules = true; + } + return isRules; + }; diff --git a/packages/uiweb/src/lib/components/chat/helpers/index.ts b/packages/uiweb/src/lib/components/chat/helpers/index.ts index eb150f0e9..55971aeab 100644 --- a/packages/uiweb/src/lib/components/chat/helpers/index.ts +++ b/packages/uiweb/src/lib/components/chat/helpers/index.ts @@ -1 +1,5 @@ -export * from './twitter'; \ No newline at end of file +export * from './twitter'; +export * from './group'; + +export * from './helper'; +export * from './tokenGatedGroup'; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/helpers/tokenGatedGroup.ts b/packages/uiweb/src/lib/components/chat/helpers/tokenGatedGroup.ts new file mode 100644 index 000000000..bbdd56109 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/helpers/tokenGatedGroup.ts @@ -0,0 +1,67 @@ +import axios from 'axios'; +import { CriteriaStateType, Data, GuildData, Rule } from '../types'; + +const handleDefineCondition = ( + entryCriteria: CriteriaStateType, + handlePrevious: (() => void) | undefined +) => { + if (entryCriteria.isCondtionUpdateEnabled()) { + // handle update + entryCriteria.updateCondition(); + } else { + // handle insertion + entryCriteria.addNewCondtion(); + } + + if (handlePrevious) { + handlePrevious(); + } +}; + +const validateGUILDData = async (condition: Rule): Promise<string[]> => { + const { data } = condition; + const errors: string[] = []; + + // Check for guild ID presence + if (!(data as GuildData).id) { + errors.push('Guild ID is missing'); + } else { + try { + const response = await axios.get( + `https://api.guild.xyz/v1/guild/${(data as GuildData).id}` + ); + + if (response.status !== 200) { + errors.push('Invalid Guild ID'); + } else { + // Validate the role values + if ((data as GuildData).role === '*') { + if (data.comparison !== 'all' && data.comparison !== 'any') { + errors.push('Invalid comparison value'); + } + } else if ((data as GuildData).role) { + const roleExists = response.data.roles.some( + (role: { id: number }) => + role.id.toString() === (data as GuildData).role + ); + if (!roleExists) { + errors.push('Invalid Guild Role ID'); + } + + // For specific role, comparison can be null or empty + if (data.comparison) { + errors.push('Comparison should be empty for specific role'); + } + } else { + errors.push('Invalid role value'); + } + } + } catch (error) { + errors.push('Error validating Guild ID'); + } + } + + return errors; +}; + +export { handleDefineCondition, validateGUILDData }; diff --git a/packages/uiweb/src/lib/components/chat/index.ts b/packages/uiweb/src/lib/components/chat/index.ts index 10531f89e..a068675e7 100644 --- a/packages/uiweb/src/lib/components/chat/index.ts +++ b/packages/uiweb/src/lib/components/chat/index.ts @@ -5,3 +5,4 @@ export * from "./ChatProfile" export * from './ChatViewComponent' export * from "./MessageInput" export * from './theme'; +export * from "./CreateGroup"; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/reusables/Button.tsx b/packages/uiweb/src/lib/components/chat/reusables/Button.tsx new file mode 100644 index 000000000..ee928cbc4 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/Button.tsx @@ -0,0 +1,106 @@ +/** + * @file Button + * generic button component for chat + * Represents the props for the Button component. + * @interface IButtonProps + * @property {string} [width] - The width of the button. Optional. + * @property {React.ReactNode} children - The content of the button. + * @property {React.MouseEventHandler} [onClick] - The click event handler for the button. Optional. + * @property {IChatTheme} [theme] - The theme for the button. Optional. + * @property {any} [customStyle] - Custom styles for the button. Optional. + */ + +import { MouseEventHandler, useContext } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; + +import { IChatTheme } from '../theme'; +import { ThemeContext } from '../theme/ThemeProvider'; + + +export interface IButtonProps { + width?: string; + height?: string; + children: any; + onClick?: MouseEventHandler; + customStyle?: CustomStyleParamsType; +} + +type CustomStyleParamsType = { + background?: string; + color?: string; + fontSize?: string; + fontWeight?: string; + padding?: string; + border?:string; + borderRadius?:string; +}; + +/** + * A button component. + * @function Button + * @param {IButtonProps} props - The props for the Button component. + * @returns {JSX.Element} The rendered Button component. + */ +export const Button: React.FC<IButtonProps> = (props) => { + const theme = useContext(ThemeContext); + + const { onClick, width, height, customStyle } = props; + console.log(customStyle) + + return ( + <ThemeProvider theme={theme}> + <ChatButton + onClick={onClick} + width={width} + height={height} + theme={theme} + customStyle={customStyle} + > + {props.children} + </ChatButton> + </ThemeProvider> + ); +}; +/* styling */ +const ChatButton = styled.button<IButtonProps>` + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap:'2px' ; + padding: ${(props) => + props.customStyle?.padding ? props.customStyle.padding : '16px'}; + margin-top: 12px; + background: ${(props) => + props.customStyle?.background + ? props.customStyle.background + : props.theme.backgroundColor.buttonBackground}; + color: ${(props) => + props.customStyle?.color + ? props.customStyle.color + : props.theme.textColor.buttonText}; + border-radius: ${(props) => + props.customStyle?.borderRadius + ? props.customStyle.borderRadius + : props.theme.borderRadius.modalInnerComponents}; + border: ${(props) => + props.customStyle?.border ? props.customStyle.border : props.theme.border.modal}; + font-size: 16px; + font-weight: ${(props) => + props.customStyle?.fontWeight ? props.customStyle.fontWeight : '500'}; + font-family: ${(props) => props.theme.fontFamily}; + + /* Inside auto layout */ + flex: none; + order: 0; + flex-grow: 0; + + transition: 150ms ease-in-out; + + &:hover { + cursor: pointer; + } + + width: ${(props) => (props.width ? props.width : '100%')}; + height: ${(props) => (props.height ? props.height : '100%')}; +`; diff --git a/packages/uiweb/src/lib/components/chat/reusables/ChatSearchInput.tsx b/packages/uiweb/src/lib/components/chat/reusables/ChatSearchInput.tsx new file mode 100644 index 000000000..17d0b6355 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/ChatSearchInput.tsx @@ -0,0 +1,189 @@ +import React, { useContext, useState } from 'react'; +import styled from 'styled-components'; +import { Div, Section, Span, Spinner } from '../../reusables'; +import { SearchIcon } from '../../../icons/Search'; +import { CloseIcon } from '../../../icons/Close'; +import { ThemeContext } from '../theme/ThemeProvider'; +import { IChatTheme } from '../theme'; + +/** + * @interface IThemeProps + * this interface is used for defining the props for styled components + */ +interface IThemeProps { + theme?: IChatTheme; + customStyle?: CustomStyleParamsType | null; +} + +type ChatSearchInputPropType = { + handleSearch: any; + clearInput: () => void; + placeholder: string; + customStyle?: CustomStyleParamsType | null; +}; +export type CustomStyleParamsType = { + background?: string; + borderRadius?: string; + placeholderColor?: string; + color?: string; + fontSize?: string; + fontWeight?: string; + border?: string; +}; + +export const ChatSearchInput: React.FC<ChatSearchInputPropType> = ({ + handleSearch, + clearInput, + customStyle = null, + placeholder, +}) => { + const theme = useContext(ThemeContext); + const [searchedText, setSearchedText] = useState<string>(''); + const [loading, setLoading] = useState<boolean>(false); + const onChangeSearchText = (val: string) => { + setSearchedText(val); + }; + + React.useEffect(() => { + setLoading(true); + const getData = setTimeout(() => { + onSearch(); + setLoading(false); + }, 2000); + return () => clearTimeout(getData); + }, [searchedText]); + + const onSearch = () => { + if (searchedText.trim() !== '') { + handleSearch({ searchedText }); + } else { + clearInput(); + } + }; + + return ( + <Container + justifyContent="space-between" + margin="4px 0" + gap="15px" + width="100%" + alignItems="center" + > + <InputSection + theme={theme} + width="100%" + background={ + customStyle?.background + ? customStyle.background + : theme.backgroundColor?.searchInputBackground + } + padding="8px 12px" + borderRadius={ + customStyle?.borderRadius + ? customStyle.borderRadius + : theme.borderRadius?.searchInput + } + customStyle={customStyle} + > + <Input + theme={theme} + customStyle={customStyle} + type="text" + value={searchedText} + onChange={(e) => onChangeSearchText(e.target.value)} + placeholder={placeholder} + onKeyDown={(event) => { + if (event.key === 'Enter') { + onSearch(); + } + }} + /> + <Span> + {!loading && !searchedText && ( + <Div + cursor="pointer" + width="17.49px" + height="17.49px" + onClick={() => onSearch()} + > + <SearchIcon /> + </Div> + )} + {!loading && searchedText && ( + <Div + cursor="pointer" + onClick={() => { + setSearchedText(''); + clearInput(); + }} + width="17.49px" + height="17.49px" + > + <CloseIcon /> + </Div> + )} + {loading && <Spinner size="17.49" color={theme.spinnerColor}/>} + </Span> + </InputSection> + </Container> + ); +}; + +//styles +const Container = styled(Section)` + border-radius: 4px; +`; + +const InputSection = styled(Section)<IThemeProps>` + border: ${(props) => + props.customStyle?.border + ? props.customStyle.border + : props.theme.border?.searchInput}; + +`; + +const Input = styled.input<IThemeProps>` + border: none; + background: ${(props) => + props.customStyle?.background + ? props.customStyle.background + : props.theme.backgroundColor?.searchInputBackground}; + width: 100%; + flex: 1; + margin-left: 10px; + font-style: normal; + color: ${(props) => + props.customStyle?.color + ? props.customStyle.color + : props.theme.textColor.searchInputText}; + font-weight: ${(props) => + props.customStyle?.fontWeight + ? props.customStyle.fontWeight + : props.theme.fontWeight.searchInputText}; + font-size: ${(props) => + props.customStyle?.fontSize + ? props.customStyle.fontSize + : props.theme.fontSize.searchInputText}; + line-height: 24px; + &:focus { + outline: none; + background-origin: border; + background-clip: padding-box, border-box; + } + &::placeholder { + color: ${(props) => + props.customStyle?.placeholderColor + ? props.customStyle.placeholderColor + : props.theme.textColor.searchPlaceholderText}; + font-weight: ${(props) => + props.customStyle?.fontWeight + ? props.customStyle.fontWeight + : props.theme.fontWeight.searchInputText}; + font-size: ${(props) => + props.customStyle?.fontSize + ? props.customStyle.fontSize + : props.theme.fontSize.searchInputText}; + } +`; + +//theme diff --git a/packages/uiweb/src/lib/components/chat/reusables/Checkbox.tsx b/packages/uiweb/src/lib/components/chat/reusables/Checkbox.tsx new file mode 100644 index 000000000..41d42f635 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/Checkbox.tsx @@ -0,0 +1,48 @@ +import React, { ChangeEvent, useContext } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { IChatTheme } from '../theme'; + +export interface ICheckboxProps { + checked: boolean; + onToggle: any; + labelName?: string; +} + +export const Checkbox = (props: ICheckboxProps) => { + const theme = useContext(ThemeContext); +console.log(props) + return ( + <ThemeProvider theme={theme}> + <CheckboxContainer> + <input type="checkbox" id="checkbox" checked={props.checked} onChange={()=>props.onToggle()} /> + <LabelContainer> + <label>{props.labelName}</label> + </LabelContainer> + + </CheckboxContainer> + </ThemeProvider> + ); +}; + +/* styling */ +const CheckboxContainer = styled.div` + display: flex; + width: 100%; + gap:5px; + align-items:center; + font-family: ${(props) => props.theme.fontFamily}; + input{ + width: 18px; +height: 18px + } +`; + +const LabelContainer = styled.div` + display: flex; + + font-weight: 400; + font-size: 16px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; +`; diff --git a/packages/uiweb/src/lib/components/chat/ChatProfile/DropDown.tsx b/packages/uiweb/src/lib/components/chat/reusables/DropDown.tsx similarity index 66% rename from packages/uiweb/src/lib/components/chat/ChatProfile/DropDown.tsx rename to packages/uiweb/src/lib/components/chat/reusables/DropDown.tsx index 991c1e6c8..39ebae3bc 100644 --- a/packages/uiweb/src/lib/components/chat/ChatProfile/DropDown.tsx +++ b/packages/uiweb/src/lib/components/chat/reusables/DropDown.tsx @@ -3,41 +3,48 @@ import { useContext } from 'react'; // External Packages import styled from 'styled-components'; -import { shortenText } from "../../../helpers"; +import { shortenText } from '../../../helpers'; // Internal Components -import { Image, Section, Span } from "../../reusables"; -import { ThemeContext } from "../theme/ThemeProvider"; - +import { Image, Section, Span } from '../../reusables'; +import { ThemeContext } from '../theme/ThemeProvider'; export type DropdownValueType = { - id: number|string, - value?: string, - title: string, - icon: string, - textColor?: string, - function: () => void, -} + invertedIcon?: any; + id: number | string; + link?: string; + value?: string; + title: string; + icon?: string; + textColor?: string; + function: () => void; +}; type DropdownProps = { - dropdownValues: any[]; + dropdownValues: DropdownValueType[]; textColor?: string; iconFilter?: string; hoverBGColor?: string; }; - // Create Dropdown -function Dropdown({ dropdownValues, textColor, iconFilter, hoverBGColor }: DropdownProps) { +function Dropdown({ + dropdownValues, + textColor, + iconFilter, + hoverBGColor, +}: DropdownProps) { const theme = useContext(ThemeContext); + const getTextColor = (dropdownValue: DropdownValueType) => { + return dropdownValue.textColor + ? dropdownValue.textColor + : textColor + ? textColor + : theme.textColor?.modalSubHeadingText; + }; - const getTextColor = (dropdownValue:DropdownValueType) => { - return dropdownValue.textColor ? dropdownValue.textColor : textColor ? textColor : theme.snackbarBorderText; - } - - - const copyToClipboard = (address:string) => { + const copyToClipboard = (address: string) => { if (navigator && navigator.clipboard) { navigator.clipboard.writeText(address); } else { @@ -49,6 +56,7 @@ function Dropdown({ dropdownValues, textColor, iconFilter, hoverBGColor }: Dropd document.body.removeChild(el); } }; + console.log(dropdownValues) return ( <> {dropdownValues.map((dropdownValue) => @@ -60,9 +68,12 @@ function Dropdown({ dropdownValues, textColor, iconFilter, hoverBGColor }: Dropd padding="2px 12px" // wrap="nowrap" margin="0px 0 8px 0" - width="max-content" - style={{cursor: "pointer"}} - onClick={() => dropdownValue?.function()} + width="100%" + style={{ cursor: 'pointer' }} + onClick={() => { + dropdownValue?.function() + // setshowDropdown?(false): true + }} > <Span margin="11px 22px 11px 2px" @@ -70,47 +81,53 @@ function Dropdown({ dropdownValues, textColor, iconFilter, hoverBGColor }: Dropd fontSize="14px" textTransform="uppercase" color="#fff" + textAlign="start" letterSpacing="1px" - width="max-content" + width="100%" > <DesktopAddress>{dropdownValue?.title}</DesktopAddress> <MobileAddress> - {shortenText(dropdownValue?.title,6)} + {shortenText(dropdownValue?.title, 6)} </MobileAddress> </Span> {dropdownValue?.invertedIcon && ( <Image - src={dropdownValue?.invertedIcon} + src={dropdownValue.invertedIcon} alt="icon" width="auto" cursor="pointer" filter="brightness(0) invert(1)" onClick={() => { - copyToClipboard(dropdownValue?.value); + copyToClipboard(dropdownValue?.value || ''); }} /> )} {dropdownValue?.icon && ( <Image - src={dropdownValue?.icon} + src={dropdownValue.icon} alt="icon" width="auto" cursor="pointer" onClick={() => { - copyToClipboard(dropdownValue?.value); + copyToClipboard(dropdownValue?.value || ''); }} /> )} </Section> ) : ( - <DropdownItemContainer hoverBGColor={hoverBGColor} onClick={() => dropdownValue?.function()}> + <DropdownItemContainer + hoverBGColor={hoverBGColor} + onClick={() => dropdownValue?.function()} + > {dropdownValue?.invertedIcon && ( <Image src={dropdownValue.invertedIcon} alt="icon" - width="max-content" + width="100%" // spacing="1px" - filter={iconFilter ? iconFilter : theme.snackbarBorderIcon} + filter={ + iconFilter ? iconFilter : theme.textColor?.modalSubHeadingText + } /> )} {dropdownValue?.icon && ( @@ -121,10 +138,11 @@ function Dropdown({ dropdownValues, textColor, iconFilter, hoverBGColor }: Dropd cursor="pointer" /> )} - {!dropdownValue?.link && dropdownValue?.function && ( + {!dropdownValue?.link && ( <Span - width="max-content" + // width="100%" color={getTextColor(dropdownValue)} + textAlign="start" margin="8px 10px" fontWeight="400" fontSize="15px" @@ -158,7 +176,7 @@ const SpanAddress = styled(Span)` text-transform: uppercase; color: #fff; spacing: 1px; - width: max-content; + width: 100%; `; const MobileAddress = styled(SpanAddress)` @@ -173,33 +191,36 @@ const DesktopAddress = styled(SpanAddress)` } `; -const DropdownItemContainer = styled(Section)<{hoverBGColor?: string}>` - width: 12.5rem; +const DropdownItemContainer = styled(Section) <{ hoverBGColor?: string }>` justify-content: flex-start; flex-wrap: nowrap; margin: 1px 0; +// width:100%; padding: 2px 8px; border-radius: 12px; cursor: pointer; text-align: left; + span { + text-wrap: nowrap; + } &:hover { background-color: ${(props) => props.hoverBGColor || 'none'}; } `; - const A = styled.a` - margin: 8px 10px; - font-weight: 400; - font-size: 16px; - width: max-content; - - background: ${(props) => props.color}; - z-index: 11; - &. hover { - background: transparent !important; - } + margin: 8px 10px; + font-weight: 400; + font-size: 16px; + width: max-content; + + background: ${(props) => props.color}; + z-index: 11; + &:hover { + background: transparent !important; + } `; + export default Dropdown; diff --git a/packages/uiweb/src/lib/components/chat/reusables/DropDownInput.tsx b/packages/uiweb/src/lib/components/chat/reusables/DropDownInput.tsx new file mode 100644 index 000000000..247510ce9 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/DropDownInput.tsx @@ -0,0 +1,116 @@ +import React, { useContext, useRef, useState } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { IChatTheme } from '../theme'; +import { Span, Image, Section } from '../../reusables'; + +import ArrowIcon from '../../../icons/CaretUp.svg'; +import { useClickAway } from '../../../hooks'; +import Dropdown, { DropdownValueType } from './DropDown'; + +export interface IDropDownInputProps { + selectedValue: number; + labelName?: string; + dropdownValues: DropdownValueType[]; +} + +export const DropDownInput = (props: IDropDownInputProps) => { + const theme = useContext(ThemeContext); + const [showDropdown, setshowDropdown] = useState<boolean>(false); + const dropdownRef = useRef<any>(null); + + const { selectedValue, dropdownValues, labelName } = props; + + // useClickAway(dropdownRef, ()=> setshowDropdown(!showDropdown)); + + const closeDropdown = () => { + setshowDropdown(!showDropdown); + }; + console.log(dropdownValues); + console.log(selectedValue); + return ( + <ThemeProvider theme={theme}> + <DropdownContainer > + <LabelContainer> + <label>{props.labelName}</label> + </LabelContainer> + + <DropdownDiv ref={dropdownRef} onClick={closeDropdown}> + <Span margin="0 7px 0 0"> + {dropdownValues[selectedValue].title}{' '} + </Span> + <ArrowImage + src={ArrowIcon} + width={'auto'} + setPosition={!showDropdown} + borderRadius="100%" + /> + </DropdownDiv> + + {showDropdown && ( + <DropdownListContainer theme={theme} onClick={closeDropdown}> + <Dropdown + dropdownValues={dropdownValues} + hoverBGColor={theme.backgroundColor?.modalHoverBackground} + /> + </DropdownListContainer> + )} + </DropdownContainer> + </ThemeProvider> + ); +}; + +//style +const DropdownContainer = styled(Section)` + display: flex; + flex-direction: column; + width: 100%; + z-index:unset; + align-items:flex-start; + font-family: ${(props) => props.theme.fontFamily}; + gap: 8px; +`; + +const LabelContainer = styled.div` + font-weight: 400; + font-size: 16px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; +`; + +const DropdownDiv = styled(Section)<IChatTheme>` + padding: 16px; + display: flex; + justify-content: space-between; + align-items: center; + + background: ${(props) => props.theme.backgroundColor.modalInputBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + + font-family: ${(props) => props.theme.fontFamily}; + font-size: 16px; + span { + text-wrap: nowrap; + } + font-weight: 500; +`; +const ArrowImage = styled(Image)<{ setPosition: boolean }>` + margin-left: auto; + transform: ${(props) => + props?.setPosition ? 'rotate(0)' : 'rotate(180deg)'}; +`; + +const DropdownListContainer = styled(Section)<IChatTheme>` + position: absolute; + width: 100%; + top:30%; + right:-9px; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + padding: 8px; + z-index: 100; + display: flex; + flex-direction: column !important; + background: ${(props) => props.theme.backgroundColor.modalBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; +`; diff --git a/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx b/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx new file mode 100644 index 000000000..f450ce552 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/Modal.tsx @@ -0,0 +1,138 @@ +/** + * @file Modal + * generic modal component for chat UI + * does not handle any business logic, acts only as a container + */ +import { useRef, useContext } from 'react'; + +import styled from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { useClickAway } from '../../../hooks'; +import { IChatTheme } from '../theme'; +import { Section, Span, Image } from '../../reusables'; +import { BackIcon } from '../../../icons/Back'; +import CloseIcon from '../../../icons/close.svg'; + +interface IModalProps { + width?: string; + clickawayClose?: () => void; + children: any; + theme?: IChatTheme; +} + +interface IModalHeader { + handlePrevious?: () => void; + handleClose: () => void; + title: string; +} + +const ClickawayCloseModal = ({ + children, + clickawayClose, + width, +}: IModalProps) => { + const modalRef = useRef(null); + const theme = useContext(ThemeContext); + + useClickAway(modalRef, () => { + if (clickawayClose) { + clickawayClose(); + } + }); + + return ( + <ModalParent ref={modalRef} width={width} theme={theme}> + {children} + </ModalParent> + ); +}; + +export const Modal = ({ clickawayClose, children, width }: IModalProps) => { + const theme = useContext(ThemeContext); + return ( + <ModalOverlay theme={theme}> + {clickawayClose ? ( + <ClickawayCloseModal clickawayClose={clickawayClose} width={width}> + {children} + </ClickawayCloseModal> + ) : ( + <ModalParent width={width} theme={theme}> + {children} + </ModalParent> + )} + </ModalOverlay> + ); +}; + +export const ModalHeader = ({ + handlePrevious, + handleClose, + title, +}: IModalHeader) => { + const theme = useContext(ThemeContext); + return ( + <Section justifyContent="center" alignItems="center" width='100%'> + {handlePrevious && ( + <Span onClick={() => handlePrevious()} cursor="pointer"> + <BackIcon /> + </Span> + )} + <Span + fontWeight="500" + fontSize="24px" + color={theme.textColor?.modalHeadingText} + flex="1" + > + {title} + </Span> + <Image + src={CloseIcon} + height="24px" + maxHeight="24px" + width={'auto'} + onClick={() => handleClose()} + cursor="pointer" + />{' '} + </Section> + ); +}; +/* styling */ + +const ModalOverlay = styled.div<IModalProps>` + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.4); /* Black with 40% opacity */ + display: flex; + color: ${(props) => props.theme.textColor.modalHeadingText ?? '#000'}; + justify-content: center; + align-items: center; + z-index: 2000; + + max-height: 100vh; + overflow-y: auto; + margin: auto !important; +`; + +const ModalParent = styled.div<IModalProps>` + display: flex; + flex-direction: column; + align-items: center; + padding: 24px 20px; + + background: ${(props) => props.theme.backgroundColor.modalBackground}; + border-radius: ${(props) => props.theme.borderRadius.modal}; + + width: ${(props) => (props.width ? props.width : 'auto')}; + margin: auto !important; + + @media (max-width: 425px) { + min-width: 300px; + max-width: 300px; + } +`; diff --git a/packages/uiweb/src/lib/components/chat/helpers/NewToast.tsx b/packages/uiweb/src/lib/components/chat/reusables/NewToast.tsx similarity index 83% rename from packages/uiweb/src/lib/components/chat/helpers/NewToast.tsx rename to packages/uiweb/src/lib/components/chat/reusables/NewToast.tsx index 3009b3054..2ba96c66d 100644 --- a/packages/uiweb/src/lib/components/chat/helpers/NewToast.tsx +++ b/packages/uiweb/src/lib/components/chat/reusables/NewToast.tsx @@ -1,27 +1,24 @@ /* eslint-disable @typescript-eslint/no-inferrable-types */ -// // React + Web3 Essentials +// React + Web3 Essentials +import { useContext, useRef } from 'react'; -// // External Packages -import { Spinner } from '../../supportChat/spinner/Spinner'; +// External Packages import { toast } from 'react-toastify'; +import { MdOutlineClose } from 'react-icons/md'; import styled, { ThemeProvider } from 'styled-components'; -import CloseIcon from '../../../icons/close.svg'; -import useMediaQuery from './useMediaQuery'; -import { useContext, useRef } from 'react'; -import { Image } from '../../reusables'; -import { device } from '../../../config'; + + +import { Spinner } from '../../supportChat/spinner/Spinner'; +import useMediaQuery from '../../../hooks/useMediaQuery'; import { ThemeContext } from '../theme/ThemeProvider'; -import { MdOutlineClose } from 'react-icons/md'; -// import useMediaQuery from './useMediaQuery'; + + +import { device } from '../../../config'; // Types type LoaderToastType = { msg: string; loaderColor: string; textColor: string }; -const override: React.CSSProperties = { - // width: "fit-content", - height: '45px', -}; const LoaderToast = ({ msg, loaderColor, textColor }: LoaderToastType) => ( @@ -29,10 +26,6 @@ const LoaderToast = ({ msg, loaderColor, textColor }: LoaderToastType) => ( <Spinner color={loaderColor} size='35px' - // height={9} - // width={2.5} - // margin={0} - // css={override} /> <LoaderMessage style={{ @@ -79,12 +72,13 @@ const useToast = ( const showLoaderToast: ShowLoaderToastType = ({ loaderMessage }) => { isLoaderToastShown = true; + console.log("in here") return (toastId.current = toast( <ThemeProvider theme={theme}> <LoaderToast msg={loaderMessage} - loaderColor="#CF1C84" - textColor={theme.snackbarBorderText!} + loaderColor={theme.spinnerColor!} + textColor={theme.textColor!.modalHeadingText!} /> </ThemeProvider>, { @@ -97,9 +91,9 @@ const useToast = ( progress: undefined, closeButton: false, style: { - background: theme.mainBg, - border: `1px solid ${theme.toastBorderColor}`, - boxShadow: `8px 8px 8px ${theme.toastShadowColor}`, + background: theme.backgroundColor?.modalBackground, + border: theme.border?.modalInnerComponents, + boxShadow: `8px 8px 8px ${theme.backgroundColor?.toastShadowBackground}`, borderRadius: '20px', }, } @@ -107,21 +101,21 @@ const useToast = ( }; const showMessageToast: ShowMessageToastType = ({ toastTitle, toastMessage, toastType, getToastIcon }) => { - + console.log('show message toast') const toastUI = ( <Toast> <ToastIcon>{getToastIcon ? getToastIcon(30) : ''}</ToastIcon> <ToastContent> <ToastTitle style={{ - color: theme.textColorPrimary, + color: theme.textColor?.modalHeadingText, }} > {toastTitle} </ToastTitle> <ToastMessage style={{ - color: theme.snackbarBorderText, + color: theme.textColor?.modalSubHeadingText, }} > {toastMessage} @@ -141,8 +135,8 @@ const useToast = ( closeButton: CloseButton, autoClose: autoClose, style: { - background: toastType === 'SUCCESS' ? theme.toastSuccessBackground : theme.toastErrorBackground, - boxShadow: `10px 10px 10px ${theme.toastShadowColor}`, + background: toastType === 'SUCCESS' ? theme.backgroundColor?.toastSuccessBackground : theme.backgroundColor?.toastErrorBackground, + boxShadow: `10px 10px 10px ${theme.backgroundColor?.toastShadowBackground}`, borderRadius: '20px', margin: isMobile ? '20px' : '0px', }, diff --git a/packages/uiweb/src/lib/components/chat/reusables/OptionButtons.tsx b/packages/uiweb/src/lib/components/chat/reusables/OptionButtons.tsx new file mode 100644 index 000000000..cdcdc3f53 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/OptionButtons.tsx @@ -0,0 +1,125 @@ +import React, { useContext } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; +import { Section, Span } from '../../reusables'; +import { Button } from './Button'; +import { ThemeContext } from '../theme/ThemeProvider'; +import { device } from '../../../config'; + +export interface OptionDescription { + heading: string; + subHeading?: string; + value: string; +} +interface OptionButtonsProps { + options: Array<OptionDescription>; + totalWidth?:string; + selectedValue: string; + handleClick: (el:string)=>void; +} + +interface ButtonSectionProps { + borderWidth: string; + borderRadius: string; + borderColor: string; + totalWidth:string; + noOfOptions:number; + // background:string; +} + +const OptionDescripton = ({ heading, subHeading,value }: OptionDescription) => { + const theme = useContext(ThemeContext); + return ( + <> + <Span + color={ + // selectedValue === value? + // theme.textColor?.modalHeadingText + // : + theme.textColor?.modalHeadingText + } + fontSize="18px" + fontWeight="500" + > + {heading} + </Span> + <Span + color={theme.textColor?.modalSubHeadingText} + fontWeight="400" + fontSize="12px" + > + {subHeading} + </Span> + </> + ); +}; + + +export const OptionButtons = ({ options,selectedValue,handleClick, totalWidth = '400px',}: OptionButtonsProps) => { + const theme = useContext(ThemeContext); + +const getBorderWidth = (index:number) =>{ + if(index === 0) + return '1px 1px 1px 1px'; + if(index >0 && index <(options.length -1)) + return '1px 1px 1px 0px'; + return '1px 1px 1px 0px'; + +} +const getBorderRadius = (index:number) =>{ + if(index === 0) + return '12px 0px 0px 12px'; + if(index >0 && index <(options.length -1)) + return '0px'; + return '0px 12px 12px 0px'; + +} + + return ( + <ThemeProvider theme={theme}> + <ButtonContainer> + {options.map((option, index) => ( + <ButtonSection + totalWidth={totalWidth} + noOfOptions={options.length} + borderRadius={ + getBorderRadius(index) + } + borderColor={theme.border!.modalInnerComponents!} + borderWidth={getBorderWidth(index)} + background={selectedValue === option.value ? theme.backgroundColor?.modalHoverBackground : 'none'} + onClick={()=>{handleClick(option.value)}} + > + <OptionDescripton {...option} /> + </ButtonSection> + ))} + </ButtonContainer> + </ThemeProvider> + ); +}; + +export default OptionButtons; + +const ButtonContainer = styled.div` + display: flex; +`; + +const ButtonSection = styled(Section)<ButtonSectionProps>` + cursor:pointer; + justify-content: center; + align-items: center; + gap: 3px; + width: ${(props) => `calc((${props.totalWidth} - 80px) / ${props.noOfOptions})`}; + @media ${device.mobileL} { + width: ${(props) => `calc(((${props.totalWidth} - 80px) / ${props.noOfOptions}) - 30px)`}; + } + padding: 10px; + border: ${(props) => props.borderColor}; + // background: ${(props) => props.background}; + border-width: ${(props) => props.borderWidth}; + border-style: solid; + border-radius: ${(props) => props.borderRadius}; + flex-direction: column; + &:hover{ + background: ${(props) => props.theme.backgroundColor.modalHoverBackground}; + } +`; diff --git a/packages/uiweb/src/lib/components/chat/reusables/ProfileContainer.tsx b/packages/uiweb/src/lib/components/chat/reusables/ProfileContainer.tsx new file mode 100644 index 000000000..70bf4843b --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/ProfileContainer.tsx @@ -0,0 +1,47 @@ +import { Section, Span,Image } from "../../reusables"; +import { IChatTheme } from "../theme"; + +type ProfileProps = { + theme: IChatTheme; + member: { wallet: string; image: string }; + customStyle?: CustomStyleParamsType | null; + }; + type CustomStyleParamsType = { + fontSize?: string; + fontWeight?: string; + imgHeight?: string; + imgMaxHeight?: string; + }; + export const ProfileContainer = ({ theme, member, customStyle }: ProfileProps) => { + + return ( + <Section justifyContent="flex-start" position="relative" zIndex="2"> + <Section + height={customStyle?.imgHeight ?? '48px'} + maxWidth="48px" + borderRadius="100%" + overflow="hidden" + margin="0px 12px 0px 0px" + position="relative" + zIndex="2" + > + <Image + height={customStyle?.imgHeight ?? '48px'} + maxHeight={customStyle?.imgMaxHeight ?? '48px'} + width={'auto'} + cursor="pointer" + src={member?.image} + /> + </Section> + <Span + fontSize={customStyle?.fontSize ?? '18px'} + fontWeight={customStyle?.fontWeight ?? '400'} + color={theme.textColor?.modalSubHeadingText} + position="relative" + zIndex="2" + > + {member.wallet} + </Span> + </Section> + ); + }; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/reusables/QuantityInput.tsx b/packages/uiweb/src/lib/components/chat/reusables/QuantityInput.tsx new file mode 100644 index 000000000..727a933fe --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/QuantityInput.tsx @@ -0,0 +1,117 @@ +import React, { ChangeEvent, useContext } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { IChatTheme } from '../theme'; +import { DropdownValueType } from './DropDown'; +import { Div, Section, Span } from '../../reusables'; +import { DropDownInput } from './DropDownInput'; +import { device } from '../../../config'; + +export type InputType = { value: number; range: number }; +export interface IQuantityInputProps { + labelName?: string; + inputValue: InputType; + placeholder?: string; + unit: string; + onInputChange: any; + dropDownValues: DropdownValueType[]; +} + +export const QuantityInput = (props: IQuantityInputProps) => { + const theme = useContext(ThemeContext); + + const handleChange = (event: ChangeEvent<HTMLInputElement>) => { + props.onInputChange(event); + }; + + return ( + <ThemeProvider theme={theme}> + <QuantityInputContainer> + <LabelContainer> + <label>{props.labelName}</label> + </LabelContainer> + <Section gap="4px" alignItems="center" > + <Section zIndex='500'> + <DropDownInput + selectedValue={props.inputValue.range} + dropdownValues={props.dropDownValues} + /> + </Section> + <Section alignItems="baseline" width='fit-content'> + <Input + type="number" + theme={theme} + value={props.inputValue.value} + onChange={handleChange} + placeholder={props.placeholder} + /> + <Unit + alignSelf='auto' + background={theme.backgroundColor?.modalHoverBackground} + width='fit-content' + height='fit-content' + + > + <Span> + {props.unit} + </Span> + </Unit> + </Section> + </Section> + </QuantityInputContainer> + </ThemeProvider> + ); +}; + +/* styling */ +const QuantityInputContainer = styled.div` + display: flex; + flex-direction: column; + width: 100%; + + font-family: ${(props) => props.theme.fontFamily}; +`; + +const LabelContainer = styled.div` + display: flex; + justify-content: space-between; + + font-weight: 500; + font-size: 16px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; +`; +const Input = styled.input<IChatTheme>` + padding: 16px; + margin-top: 8px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; + + background: ${(props) => props.theme.backgroundColor.modalInputBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-width: 1px 0px 1px 1px; + border-radius: 12px 0 0 12px; + font-family: ${(props) => props.theme.fontFamily}; + font-size: 16px; + width:60%; + font-weight: 500; +`; + +const Unit = styled(Section)<IChatTheme>` +span{ + font-size:14px; + font-weight:700; +} +border-radius:0 12px 12px 0; + +padding:17.2px; +border: ${(props) => props.theme.border.modalInnerComponents}; +@media ${device.mobileL} { + + padding:19.5px 5px; + span{ + font-size: 10px; + font-weight:400 + } +} + +`; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/reusables/TextArea.tsx b/packages/uiweb/src/lib/components/chat/reusables/TextArea.tsx new file mode 100644 index 000000000..96385f883 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/TextArea.tsx @@ -0,0 +1,82 @@ +import React, {ChangeEvent, useContext} from 'react' +import styled, { ThemeProvider } from 'styled-components' + +import { IChatTheme } from '../theme' +import { ThemeContext } from '../theme/ThemeProvider' + +export interface ITextAreaProps { + charCount: number; + labelName?: string; + inputValue: string; + onInputChange: any; + +} + +export const TextArea = (props: ITextAreaProps) => { + const theme = useContext(ThemeContext) + + const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => { + const newText = event.target.value; + const count = newText.length; + + if(count <= props.charCount) { + props.onInputChange(event); + } + }; + + return ( + <ThemeProvider theme={theme}> + <InputContainer> + <LabelContainer> + <label>{props.labelName}</label> + <CharCounter theme={theme}>{props.inputValue.length} / {props.charCount}</CharCounter> + </LabelContainer> + <Input theme={theme} value={props.inputValue} onChange={handleChange} /> + </InputContainer> + </ThemeProvider> + ) +} + +const InputContainer = styled.div` + display: flex; + flex-direction: column; + + width: 100%; + + font-family: ${(props) => props.theme.fontFamily}; +`; + + +const LabelContainer = styled.div` + display: flex; + justify-content: space-between; + + font-weight: 500; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; +`; + +const Input = styled.textarea<IChatTheme>` + padding: 16px; + margin-top: 8px; + + // width: 330px; + height: 121px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; + + background: ${(props) => props.theme.backgroundColor.modalInputBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + + font-family: ${(props) => props.theme.fontFamily}; + font-size: 14px; + &:focus { + border: 1px solid #ffdbf0; + } +`; + +const CharCounter = styled.div<IChatTheme>` +color: ${(props) => props.theme.textColor?.modalSubHeadingText}; +font-size: 14px; + + font-weight: 400; +`; diff --git a/packages/uiweb/src/lib/components/chat/reusables/TextInput.tsx b/packages/uiweb/src/lib/components/chat/reusables/TextInput.tsx new file mode 100644 index 000000000..1d5c54995 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/TextInput.tsx @@ -0,0 +1,107 @@ +import React, { ChangeEvent, useContext } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; +import { IChatTheme } from '../theme'; + +export interface ITextInputProps { + charCount?: number; + labelName?: string; + inputValue: string; + placeholder?: string; + onInputChange?: any; + disabled?: boolean; + customStyle?: CustomStyleParamsType; +} +type CustomStyleParamsType = { + background?: string; +}; + +export const TextInput = (props: ITextInputProps) => { + const theme = useContext(ThemeContext); + + const handleChange = (event: ChangeEvent<HTMLInputElement>) => { + if (props.charCount) { + const newText = event.target.value; + const count = newText.length; + + if (count <= props.charCount) { + props.onInputChange(event); + } + } else { + props.onInputChange(event); + } + }; + + return ( + <ThemeProvider theme={theme}> + <InputContainer> + <LabelContainer> + <label>{props.labelName}</label> + {props.charCount && ( + <CharCounter theme={theme}> + {props.inputValue.length} / {props.charCount} + </CharCounter> + )} + </LabelContainer> + <Input + customStyle={props.customStyle!} + disabled={!!props.disabled} + theme={theme} + value={props.inputValue} + onChange={handleChange} + placeholder={props.placeholder} + /> + </InputContainer> + </ThemeProvider> + ); +}; + +/* styling */ +const InputContainer = styled.div` + display: flex; + flex-direction: column; + width: 100%; + + font-family: ${(props) => props.theme.fontFamily}; +`; + +const LabelContainer = styled.div` + display: flex; + justify-content: space-between; + + font-weight: 500; + font-size: 16px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; +`; + +const Input = styled.input<IChatTheme & {customStyle:CustomStyleParamsType}>` + padding: 16px; + margin-top: 8px; + color: ${(props) => props.theme.textColor?.modalHeadingText ?? '#000'}; + background: ${(props) => + props.customStyle?.background + ? props.customStyle.background + : props.theme.backgroundColor.modalInputBackground}; + border: ${(props) => props.theme.border.modalInnerComponents}; + border-radius: ${(props) => props.theme.borderRadius.modalInnerComponents}; + + font-family: ${(props) => props.theme.fontFamily}; + font-size: 16px; + + font-weight: 500; + [readonly='readonly'] { + pointer-events: none; + } + &:focus { + border: 1px solid #ffdbf0; + } + +`; + +const CharCounter = styled.div<IChatTheme>` + color: ${(props) => props.theme.textColor?.modalSubHeadingText}; + font-size: 14px; + + font-weight: 400; +`; diff --git a/packages/uiweb/src/lib/components/chat/reusables/ToggleInput.tsx b/packages/uiweb/src/lib/components/chat/reusables/ToggleInput.tsx new file mode 100644 index 000000000..7f7dad8bb --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/ToggleInput.tsx @@ -0,0 +1,114 @@ +import React, { useContext } from 'react'; +import styled, { ThemeProvider } from 'styled-components'; + +import { ThemeContext } from '../theme/ThemeProvider'; + +export interface IToggleInputProps { + labelHeading?: string; + labelSubHeading?: string; + checked: boolean; + onToggle: any; +} + +interface ILabelProps { + fontSize?: string; + fontWeight?: string; + textColor?: string; +} +export const ToggleInput = (props: IToggleInputProps) => { + + const theme = useContext(ThemeContext); + + return ( + <ThemeProvider theme={theme}> + <ToggleContainer> + <LabelContainer> + <Label textColor={theme.textColor?.modalHeadingText}> + {props.labelHeading} + </Label> + <Label + textColor={theme.textColor?.modalSubHeadingText} + fontSize='12px' + fontWeight='400' + > + {props.labelSubHeading} + </Label> + </LabelContainer> + <ToggleLabel htmlFor="checkbox"> + <input type="checkbox" id="checkbox" checked={props.checked} onChange={()=>props.onToggle()} /> + <div className="slider round"></div> + </ToggleLabel> + {/* <input type="checkbox" id="checkbox" /> + <div class="slider round"></div> */} + </ToggleContainer> + </ThemeProvider> + ); +}; + +/* styling */ +const ToggleContainer = styled.div` + display: flex; + justify-content: space-between; + width:100%; + gap:10px; + font-family: ${props => props.theme.fontFamily}; + align-items:center; +`; + +const LabelContainer = styled.div` + display: flex; + flex-direction: column; + gap:4px; + width:73%; +`; +const Label = styled.label<ILabelProps>` + font-size: ${(props) => props.fontSize ?? '16px'}; + font-weight: ${(props) => props.fontWeight ?? '500'}; + color: ${(props) => props.textColor ?? '#000'}; +`; + +const ToggleLabel = styled.label` + display: inline-block; + height: 24px; + position: relative; + width: 44px; + padding:2px; + input { + display: none; + } + .slider { + background-color: #ccc; + bottom: 0; + cursor: pointer; + left: 0; + position: absolute; + right: 0; + top: 0; + transition: 0.4s; + } + .slider:before { + background-color: #fff; + bottom: 4px; + content: ''; + height: 20px; + left: 4px; + position: absolute; + transition: 0.4s; + width: 20px; + } + input:checked + .slider { + background-color: ${(props) =>props.theme.backgroundColor.buttonBackground}; + } + + input:checked + .slider:before { + transform: translateX(20px); + } + .slider.round { + border-radius: 34px; + } + + .slider.round:before { + border-radius: 50%; + } +`; + diff --git a/packages/uiweb/src/lib/components/chat/reusables/index.ts b/packages/uiweb/src/lib/components/chat/reusables/index.ts new file mode 100644 index 000000000..e8f20ba6d --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/reusables/index.ts @@ -0,0 +1,14 @@ +export * from './ChatSearchInput'; +export * from './DropDown'; +export * from './ProfileContainer'; +export * from './Modal'; +export * from './NewToast'; +export * from './TextInput'; +export * from './ToggleInput'; +export * from './DropDownInput'; +export * from './TextArea'; +export * from './OptionButtons'; +export * from './Button'; +export * from './QuantityInput'; +export * from './OptionButtons'; +export * from './Checkbox'; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/theme/index.ts b/packages/uiweb/src/lib/components/chat/theme/index.ts index 34947cdb4..de2b3b886 100644 --- a/packages/uiweb/src/lib/components/chat/theme/index.ts +++ b/packages/uiweb/src/lib/components/chat/theme/index.ts @@ -3,130 +3,303 @@ */ import { CHAT_THEME_OPTIONS } from '../exportedTypes'; -export interface IChatTheme { - bgColorPrimary?: string; - bgColorSecondary?: string; - textColorPrimary?: string; - textColorSecondary?: string; - accentBgColor?: string; - accentTextColor?: string; - btnColorPrimary?: string; - chatBubbleAccentBgColor?:string; - border?: string; - borderRadius?: string; - iconColorPrimary?: string; - fontFamily?: string; - chatBubblePrimaryBgColor?: string; - fileIconColor?: string; - dropdownBorderColor?: string; - modalPrimaryTextColor?: string; - modalSearchBarBorderColor?: string; - modalSearchBarBackground?: string; - snapFocusBg?: string; - groupButtonBackgroundColor?: string; - groupButtonTextColor?: string; - modalConfirmButtonBorder?: string; - groupSearchProfilBackground?: string, - modalInputBorderColor?: string, - snackbarBorderText?: string, - snackbarBorderIcon?: string, - modalContentBackground?: string, - modalProfileTextColor?: string, +//theme type +interface IBorder { + chatViewComponent?: string; + chatProfile?: string; + messageInput?: string; + searchInput?:string; + modal?:string; + modalInnerComponents?:string; +} +interface IBorderRadius { + chatViewComponent?: string; + chatProfile?: string; + messageInput?: string; + searchInput?:string; + modal?:string; + modalInnerComponents?:string; +} +interface IBackgroundColor { + chatViewComponentBackground?: string; + chatProfileBackground?: string; + messageInputBackground?: string; + chatSentBubbleBackground?: string; + chatReceivedBubbleBackground?: string; + encryptionMessageBackground?: string; + buttonBackground?: string; + buttonDisableBackground?: string; + searchInputBackground?:string; + modalBackground?:string; + modalInputBackground?:string; + modalHoverBackground?:string; toastSuccessBackground?: string; toastErrorBackground?: string; - toastShadowColor?: string; - toastBorderColor?: string; - mainBg?: string; - modalBorderColor?: string; - modalDescriptionTextColor?: string; - modalIconColor?: string; - pendingCardBackground?: string, - modalHeadingColor?: string; - defaultBorder?: string; + toastShadowBackground?: string; +} + +interface ITextColor { + chatProfileText?: string; + messageInputText?: string; + chatSentBubbleText?: string; + chatReceivedBubbleText?: string; + timestamp?: string; + encryptionMessageText?: string; + buttonText?: string; + buttonDisableText?: string; + chatReceivedBubbleAddressText?: string; + chatReceivedBubbleTimestampText?: string; + chatSentBubbleTimestampText?: string; + searchInputText?:string; + searchPlaceholderText?:string; + modalHeadingText?:string; + modalSubHeadingText?:string; +} +interface IFont { + chatProfileText?: string; + messageInputText?: string; + chatSentBubbleText?: string; + chatReceivedBubbleText?: string; + timestamp?: string; + encryptionMessageText?: string; + chatReceivedBubbleAddressText?: string; + chatReceivedBubbleTimestampText?: string; + chatSentBubbleTimestampText?: string; + searchInputText?:string; + searchPlaceholderText?:string; +} +interface IFontWeight { + chatProfileText?: string; + messageInputText?: string; + chatSentBubbleText?: string; + chatReceivedBubbleText?: string; + timestamp?: string; + encryptionMessageText?: string; + chatReceivedBubbleAddressText?: string; + chatReceivedBubbleTimestampText?: string; + chatSentBubbleTimestampText?: string; + searchInputText?:string; + searchPlaceholderText?:string; +} +interface IIconColor { + emoji?: string; + attachment?: string; + sendButton?: string; + groupSettings?: string; +} +export interface IChatTheme { + borderRadius?: IBorderRadius; + + backgroundColor?: IBackgroundColor; + + fontSize?: IFont; + + fontWeight?: IFontWeight; + + fontFamily?: string; + + border?: IBorder; + iconColor?: IIconColor; + textColor?: ITextColor; + backdropFilter?: string; + scrollbarColor?: string; + + spinnerColor?: string; + } +//dark theme object export const lightChatTheme: IChatTheme = { - bgColorPrimary: '#fff', - chatBubblePrimaryBgColor: '#fff', - bgColorSecondary: - 'linear-gradient(179.97deg, #EEF5FF 0.02%, #ECE9FA 123.25%)', - textColorPrimary: '#000', - textColorSecondary: 'rgb(101, 119, 149)', - chatBubbleAccentBgColor: 'rgb(202, 89, 155)', - accentBgColor: 'rgb(202, 89, 155)', - accentTextColor: '#fff', - btnColorPrimary: 'rgb(202, 89, 155)', - border: 'none', - borderRadius: '24px', - iconColorPrimary: 'none', - fileIconColor: '#000', - dropdownBorderColor: '1px solid rgb(229, 232, 246)', - modalPrimaryTextColor: '#1E1E1E', - modalSearchBarBorderColor: '#BAC4D6', - modalSearchBarBackground: '#FFF', - snapFocusBg: '#F4F5FA', - groupButtonBackgroundColor: '#ADB0BE', - groupButtonTextColor: '#FFF', - modalConfirmButtonBorder: '1px solid #F4DCEA', - groupSearchProfilBackground: '#F4F5FA', - modalInputBorderColor: '#C2CBDB', - snackbarBorderText: '#000', - snackbarBorderIcon: 'none', - modalContentBackground: '#FFFFFF', - modalProfileTextColor: '#1E1E1E', - toastSuccessBackground: 'linear-gradient(90.15deg, #30CC8B -125.65%, #30CC8B -125.63%, #F3FFF9 42.81%)', - toastErrorBackground: 'linear-gradient(90.15deg, #FF2070 -125.65%, #FF2D79 -125.63%, #FFF9FB 42.81%)', - toastShadowColor: '#ccc', - toastBorderColor: '#F4F3FF', - mainBg: '#fff', - modalBorderColor: '#E5E8F6', - modalDescriptionTextColor: '#575D73', - modalIconColor: '#657795', - pendingCardBackground: 'rgba(173, 176, 190, 0.12)', - modalHeadingColor: '#333333', - defaultBorder: '#E5E8F6', + borderRadius: { + chatViewComponent: '24px', + chatProfile: '32px', + messageInput: '13px', + searchInput: '99px', + modal: '16px', + modalInnerComponents:'12px' + }, + + backgroundColor: { + chatViewComponentBackground: + 'linear-gradient(179.97deg, #EEF5FF 0.02%, #ECE9FA 123.25%)', + chatProfileBackground: '#fff', + messageInputBackground: '#fff', + chatSentBubbleBackground: 'rgb(202, 89, 155)', + chatReceivedBubbleBackground: '#fff', + encryptionMessageBackground: '#fff', + buttonBackground: 'rgb(202, 89, 155)', + searchInputBackground: 'rgb(244, 245, 250)', + modalBackground:'#fff', + modalInputBackground:'transparent', + modalHoverBackground:'rgb(244, 245, 250)', + buttonDisableBackground:'#DFDEE9', + toastSuccessBackground: + 'linear-gradient(90.15deg, #30CC8B -125.65%, #30CC8B -125.63%, #F3FFF9 42.81%)', + toastErrorBackground: + 'linear-gradient(90.15deg, #FF2070 -125.65%, #FF2D79 -125.63%, #FFF9FB 42.81%)', + toastShadowBackground: '#ccc', + }, + + fontSize: { + chatProfileText: '17px', + messageInputText: '16px', + chatSentBubbleText: '16px', + chatReceivedBubbleText: '16px', + timestamp: '12px', + encryptionMessageText: '13px', + chatReceivedBubbleAddressText: '16px', + chatReceivedBubbleTimestampText: '12px', + chatSentBubbleTimestampText: '12px', + searchInputText:'16px', + searchPlaceholderText:'16px' + }, + + fontWeight: { + chatProfileText: '300', + messageInputText: '400', + chatSentBubbleText: '400', + chatReceivedBubbleText: '400', + timestamp: '400', + encryptionMessageText: '400', + chatReceivedBubbleAddressText: '300', + chatReceivedBubbleTimestampText: '400', + chatSentBubbleTimestampText: '400', + searchInputText:'400', + searchPlaceholderText:'400' + }, + + fontFamily: 'inherit', + + border: { + chatViewComponent: 'none', + chatProfile: 'none', + messageInput: 'none', + searchInput:'1px solid transparent', + modal:'none', + modalInnerComponents:'1px solid rgb(194, 203, 219)' + }, + + iconColor: { + emoji: 'rgb(101, 119, 149)', + attachment: 'rgb(101, 119, 149)', + sendButton: 'rgb(101, 119, 149)', + groupSettings: 'rgb(101, 119, 149)', + }, + textColor: { + chatProfileText: '#000', + messageInputText: '#000', + chatSentBubbleText: '#fff', + chatReceivedBubbleText: '#000', + timestamp: '400', + encryptionMessageText: '#000', + buttonText: '#fff', + buttonDisableText:'#AFB3BF', + chatReceivedBubbleAddressText: '#000', + chatReceivedBubbleTimestampText: '#000', + chatSentBubbleTimestampText: '#fff', + searchInputText:'#000', + searchPlaceholderText:'rgb(101, 119, 149)', + modalHeadingText:'#000', + modalSubHeadingText:'rgb(101, 119, 149)', + }, + backdropFilter: 'none', + spinnerColor: 'rgb(202, 89, 155)', + scrollbarColor: 'rgb(202, 89, 155)', }; export const darkChatTheme: IChatTheme = { - chatBubblePrimaryBgColor: '#fff', - bgColorPrimary: 'rgb(47, 49, 55)', - bgColorSecondary: 'rgb(40, 42, 46)', - textColorPrimary: '#fff', - textColorSecondary: 'rgb(182, 188, 214)', - chatBubbleAccentBgColor: 'rgb(202, 89, 155)', - accentBgColor: 'rgb(202, 89, 155)', - accentTextColor: '#fff', - btnColorPrimary: 'rgb(202, 89, 155)', - border: 'none', - borderRadius: '24px', - iconColorPrimary: - 'brightness(0) saturate(100%) invert(89%) sepia(8%) saturate(1567%) hue-rotate(191deg) brightness(86%) contrast(93%)', - dropdownBorderColor: '1px solid rgb(74, 79, 103)', - fileIconColor: '#fff', - modalPrimaryTextColor: '#B6BCD6', - modalSearchBarBorderColor: '#4A4F67', - modalSearchBarBackground: '#282A2E', - snapFocusBg: '#404650', - groupButtonBackgroundColor: '#2F3137', - groupButtonTextColor: '#787E99', - modalConfirmButtonBorder: '1px solid #787E99', - groupSearchProfilBackground: '#404650', - modalInputBorderColor: '#4A4F67', - snackbarBorderText: '#B6BCD6', - snackbarBorderIcon: - 'brightness(0) saturate(100%) invert(89%) sepia(8%) saturate(1567%) hue-rotate(191deg) brightness(86%) contrast(93%)', - modalContentBackground: '#2F3137', - modalProfileTextColor: '#B6BCD6', - toastSuccessBackground: 'linear-gradient(90.15deg, #30CC8B -125.65%, #30CC8B -125.63%, #2F3137 42.81%)', - toastErrorBackground: 'linear-gradient(89.96deg, #FF2070 -101.85%, #2F3137 51.33%)', - toastShadowColor: '#00000010', - toastBorderColor: '#4A4F67', - mainBg: '#000', - modalBorderColor: '#4A4F67', - modalDescriptionTextColor: '#787E99', - modalIconColor: '#787E99', - pendingCardBackground: 'rgba(173, 176, 190, 0.08)', - modalHeadingColor: '#B6BCD6', - defaultBorder: '#4A4F67' -}; + borderRadius: { + chatViewComponent: '24px', + chatProfile: '32px', + messageInput: '13px', + searchInput: '99px', + modal: '16px', + modalInnerComponents:'12px' + }, + + backgroundColor: { + chatViewComponentBackground: 'rgb(40, 42, 46);', + chatProfileBackground: 'rgb(64, 70, 80);', + messageInputBackground: 'rgb(64, 70, 80);', + chatSentBubbleBackground: 'rgb(202, 89, 155)', + chatReceivedBubbleBackground: 'rgb(64, 70, 80);', + encryptionMessageBackground: 'rgb(64, 70, 80);', + buttonBackground: 'rgb(202, 89, 155)', + modalBackground:'rgb(47, 49, 55)', + modalInputBackground:'transparent', + modalHoverBackground:'rgb(64, 70, 80)', + buttonDisableBackground:'#787E99', + toastSuccessBackground: + 'linear-gradient(90.15deg, #30CC8B -125.65%, #30CC8B -125.63%, #2F3137 42.81%)', + toastErrorBackground: + 'linear-gradient(89.96deg, #FF2070 -101.85%, #2F3137 51.33%)', + toastShadowBackground: '#00000010', + }, + + fontSize: { + chatProfileText: '17px', + messageInputText: '16px', + chatSentBubbleText: '16px', + chatReceivedBubbleText: '16px', + timestamp: '12px', + encryptionMessageText: '13px', + chatReceivedBubbleAddressText: '16px', + chatReceivedBubbleTimestampText: '12px', + chatSentBubbleTimestampText: '12px', + searchInputText:'16px', + searchPlaceholderText:'16px' + }, + + fontWeight: { + chatProfileText: '300', + messageInputText: '400', + chatSentBubbleText: '400', + chatReceivedBubbleText: '400', + timestamp: '400', + encryptionMessageText: '400', + chatReceivedBubbleAddressText: '300', + chatReceivedBubbleTimestampText: '400', + chatSentBubbleTimestampText: '400', + searchInputText:'400', + searchPlaceholderText:'400' + }, + fontFamily: 'inherit', + + border: { + chatViewComponent: 'none', + chatProfile: 'none', + messageInput: 'none', + searchInput:'1px solid transparent', + modal:'none', + modalInnerComponents:'1px solid rgb(74, 79, 103)' + }, + + iconColor: { + emoji: 'rgba(120, 126, 153, 1)', + attachment: 'rgba(120, 126, 153, 1)', + sendButton: 'rgba(120, 126, 153, 1)', + groupSettings: 'rgba(120, 126, 153, 1)', + }, + textColor: { + chatProfileText: 'rgb(182, 188, 214)', + messageInputText: 'rgb(182, 188, 214)', + chatSentBubbleText: '#fff', + chatReceivedBubbleText: 'rgb(182, 188, 214)', + timestamp: 'rgb(182, 188, 214)', + encryptionMessageText: 'rgb(182, 188, 214)', + buttonText: '#fff', + chatReceivedBubbleAddressText: 'rgb(182, 188, 214)', + chatReceivedBubbleTimestampText: 'rgb(182, 188, 214)', + chatSentBubbleTimestampText: '#fff', + searchInputText:'#fff', + searchPlaceholderText:'rgb(101, 119, 149)', + modalHeadingText:'#fff', + modalSubHeadingText:'rgb(182, 188, 214)', + buttonDisableText:'#B6BCD6' + }, + backdropFilter: 'none', + spinnerColor: 'rgb(202, 89, 155)', + scrollbarColor: 'rgb(202, 89, 155)', + +}; diff --git a/packages/uiweb/src/lib/components/chat/types/index.ts b/packages/uiweb/src/lib/components/chat/types/index.ts new file mode 100644 index 000000000..0f51020e9 --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/types/index.ts @@ -0,0 +1,76 @@ +import { DropdownValueType } from '../reusables'; + +export interface GrouInfoType{ + groupName: string; + groupDescription:string; + groupImage:string; + isPublic: boolean; +} + +export const TYPE = { + PUSH: 'PUSH', + GUILD: 'GUILD', +} as const; + +export type TypeKeys = (typeof TYPE)[keyof typeof TYPE]; + +export const CATEGORY = { + ERC20: 'ERC20', + ERC721: 'ERC721', + INVITE: 'INVITE', + CustomEndpoint: 'CustomEndpoint', + ROLES: 'ROLES', +} as const; + +export const UNIT = { + ERC20: 'TOKEN', + ERC721: 'NFT', +} as const; +export type UnitKeys = (typeof UNIT)[keyof typeof UNIT]; +export const SUBCATEGORY = { + HOLDER: 'holder', + OWENER: 'owner', + // INVITE: 'INVITE', + GET: 'GET', + DEFAULT: 'DEFAULT', +} as const; + +export type ReadonlyInputType = { + value: string; + title: string; + }; +export type InputType = + | DropdownValueType[] + | ReadonlyInputType; +export type SubCategoryKeys = (typeof CATEGORY)[keyof typeof CATEGORY]; + +export type DropdownCategoryValuesType = { + [key in TypeKeys]: InputType; +}; + +export type DropdownSubCategoryValuesType = { + [key in SubCategoryKeys]: InputType; +}; + +export const TOKEN_NFT_COMPARISION = { +'>':'more than', +'>=': 'equal or more than', +'<': 'less than', +'<=': 'equal or less than', +'==': 'equal to', +'!=':'not equal to' +} as const; + +export type TokenNftComparision = keyof typeof TOKEN_NFT_COMPARISION; + +export const CRITERIA_TYPE = { + ERC20:'Token', + ERC721: 'NFT', + INVITE: 'Invite', + CustomEndpoint: 'URL', + ROLES: 'Guild ID', + } as const; + + export type CriteriaType = keyof typeof CRITERIA_TYPE; + +export * from './tokenGatedGroupCreationType' \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/chat/types/tokenGatedGroupCreationType.ts b/packages/uiweb/src/lib/components/chat/types/tokenGatedGroupCreationType.ts new file mode 100644 index 000000000..07344afbf --- /dev/null +++ b/packages/uiweb/src/lib/components/chat/types/tokenGatedGroupCreationType.ts @@ -0,0 +1,75 @@ +export interface PushData { + contract?: string; + amount?: number; + decimals?: number; + inviterRoles?: string[]; + comparison?:string; + url?: string; +} + +export interface GuildData { + id: string; + role: string; + comparison: string; +} + +export type Data = PushData | GuildData; + +export interface Rule { + type: string; + // category: 'ERC20' | 'ERC721'; + category: string; + subcategory: string; + data: Data; +} + +export type Condition = Rule | AnyCondition | AllCondition; + +export interface AnyCondition { + any: Condition[]; +} + +export interface AllCondition { + all: Condition[]; +} + +export interface ChatConditions { + conditions: AllCondition | AnyCondition; +} + +export interface TokenGatedRule{ + chat:ChatConditions, + entry:ChatConditions +} + +export type ConditionType = 'any' | 'all'; + +export interface CriteriaStateType { + entryRootCondition: ConditionType; + setEntryRootCondition: React.Dispatch<React.SetStateAction<ConditionType>>; + entryRuleTypeCondition: ConditionType; + setEntryRuleTypeCondition: React.Dispatch< + React.SetStateAction<ConditionType> + >; + entryOptionTypeArray: ConditionType[]; + setEntryOptionTypeArray: React.Dispatch< + React.SetStateAction<ConditionType[]> + >; + entryOptionsDataArray: Rule[][]; + setEntryOptionsDataArray: React.Dispatch<React.SetStateAction<Rule[][]>>; + selectedCriteria: number; + setSelectedCriteria: React.Dispatch<React.SetStateAction<number>>; + selectedRules: Rule[]; + setSelectedRule: React.Dispatch<React.SetStateAction<Rule[]>>; + addNewCondtion: () => void; + addNewRule: (newRule: Rule) => void; + deleteRule: (idx: number) => void; + deleteEntryOptionsDataArray: (idx: number) => void; + selectEntryOptionsDataArrayForUpdate: (idx: number) => void; + entryOptionsDataArrayUpdate: number; + isCondtionUpdateEnabled: () => boolean; + updateCondition: () => void; + updateCriteriaIdx: number; + setUpdateCriteriaIdx: React.Dispatch<React.SetStateAction<number>>; + isUpdateCriteriaEnabled: () => boolean; +} diff --git a/packages/uiweb/src/lib/components/notification/chainDetails.tsx b/packages/uiweb/src/lib/components/notification/chainDetails.tsx index ad783c516..403f12c39 100644 --- a/packages/uiweb/src/lib/components/notification/chainDetails.tsx +++ b/packages/uiweb/src/lib/components/notification/chainDetails.tsx @@ -7,7 +7,7 @@ import { BSCSvg } from "../../icons/BSCSvg"; import { OptimismSvg } from "../../icons/OptimismSvg"; import { PolygonzkevmSvg } from "../../icons/PolygonzkevmSvg"; import { TheGraphSvg } from "../../icons/TheGraphSvg"; -import { ReactElement } from "react"; +import { ArbitrumSvg } from "../../icons/ArbitrumSvg" const createSVGIcon = (element:any, chainName: string) => { return ( @@ -58,5 +58,14 @@ export default { label: 'POLYGON ZK EVM MAINNET', icon: createSVGIcon(<PolygonzkevmSvg/>, 'Polygon ZK EVM Mainnet'), }, + + ARBITRUMONE_MAINNET: { + label: 'ARBITRUMONE MAINNET', + icon: createSVGIcon(<ArbitrumSvg/>, 'Arbitrum Mainnet'), + }, + ARBITRUM_TESTNET: { + label: 'ARBITRUM TESTNET', + icon: createSVGIcon(<ArbitrumSvg/>, 'Arbitrum Testnet'), + }, THE_GRAPH: { label: 'THE GRAPH', icon: createSVGIcon(<TheGraphSvg/>, 'The Graph') }, }; diff --git a/packages/uiweb/src/lib/components/notification/index.tsx b/packages/uiweb/src/lib/components/notification/index.tsx index bcec3907b..8ce4dd911 100644 --- a/packages/uiweb/src/lib/components/notification/index.tsx +++ b/packages/uiweb/src/lib/components/notification/index.tsx @@ -34,6 +34,8 @@ export type chainNameType = | 'OPTIMISM_TESTNET' | 'POLYGON_ZK_EVM_TESTNET' | 'POLYGON_ZK_EVM_MAINNET' + | 'ARBITRUMONE_MAINNET' + | 'ARBITRUM_TESTNET' | 'THE_GRAPH' | undefined; diff --git a/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx b/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx index 2e996e542..ae5ee621e 100644 --- a/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx +++ b/packages/uiweb/src/lib/components/space/SpaceWidget/LiveWidgetContent.tsx @@ -1,9 +1,13 @@ -import React, { useEffect, useState, useContext } from 'react'; +import React, { useEffect, useState, useContext, useMemo } from 'react'; import styled, { ThemeProvider } from 'styled-components'; import { Player } from '@livepeer/react'; import * as PushAPI from '@pushprotocol/restapi'; import { SpaceDTO } from '@pushprotocol/restapi'; +// livekit imports +import { LiveKitRoom, ConnectionState, RoomAudioRenderer, TrackToggle, ConnectionStateToast } from '@livekit/components-react'; +import { Room, Track } from 'livekit-client'; + import { LiveSpaceProfileContainer } from './LiveSpaceProfileContainer'; import { SpaceMembersSectionModal } from './SpaceMembersSectionModal'; @@ -12,7 +16,7 @@ import { ThemeContext } from '../theme/ThemeProvider'; import CircularProgressSpinner from '../../loader/loader'; -import { Button, Image, Item, Text } from '../../../config'; +import { Button, Image, Item, LIVEKIT_SERVER_URL, Text } from '../../../config'; import MicOnIcon from '../../../icons/micon.svg'; import MicEngagedIcon from '../../../icons/MicEngage.svg'; import MuteIcon from '../../../icons/Muted.svg'; @@ -21,18 +25,22 @@ import MembersIcon from '../../../icons/Members.svg'; import { useSpaceData } from '../../../hooks'; import { SpaceStatus } from './WidgetContent'; import { pCAIP10ToWallet } from '../../../helpers'; +import { getLivekitRoomToken, performAction } from '../../../services'; +import Microphone from './Microphone'; interface LiveWidgetContentProps { spaceData?: SpaceDTO; // temp props only for testing demo purpose for now isHost?: boolean; setSpaceStatusState: React.Dispatch<React.SetStateAction<any>>; + account: string | undefined; } export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ spaceData, isHost, setSpaceStatusState, + account }) => { const [showMembersModal, setShowMembersModal] = useState<boolean>(false); const [playBackUrl, setPlayBackUrl] = useState<string>(''); @@ -41,6 +49,7 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ const [isRequestedForMic, setIsRequestedForMic] = useState(false); const [promotedListener, setPromotedListener] = useState(''); + const [livekitToken, setLivekitToken] = useState(null); const theme = useContext(ThemeContext); @@ -54,15 +63,31 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ initSpaceObject, raisedHandInfo, } = useSpaceData(); + console.log("🚀 ~ file: LiveWidgetContent.tsx:66 ~ raisedHandInfo:", raisedHandInfo) const isMicOn = spaceObjectData?.connectionData?.local?.audio; - const numberOfRequests = spaceObjectData.liveSpaceData.listeners.filter((listener: any) => listener.handRaised).length; + // const numberOfRequests = spaceObjectData.liveSpaceData.listeners.filter((listener: any) => listener.handRaised).length; const handleMicState = async () => { await spacesObjectRef?.current?.enableAudio?.({ state: !isMicOn }); }; + useEffect(() => { + (async function () { + const removeEIP155 = (input: string) => input.substring(7); + const nonEIPAddress = removeEIP155(account as string); + + if ((isHost || isSpeaker) && spaceData?.spaceId) { + const livekitToken = await getLivekitRoomToken({ userType: "sender", roomId: spaceData?.spaceId, userId: nonEIPAddress }); + setLivekitToken(livekitToken.data); + } else if (isListener && spaceData?.spaceId) { + const livekitToken = await getLivekitRoomToken({ userType: "receiver", roomId: spaceData?.spaceId, userId: nonEIPAddress }); + setLivekitToken(livekitToken.data); + } + })(); + }, [isListener, isHost, spaceData]); + useEffect(() => { if (!spaceObjectData?.connectionData?.local?.stream || !isRequestedForMic) return; @@ -83,11 +108,13 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ }; useEffect(() => { - if (!spaceObjectData?.connectionData?.local?.stream || promotedListener.length === 0) + // if (!spaceObjectData?.connectionData?.local?.stream || promotedListener.length === 0) + // return; + if (promotedListener.length === 0 || Object.keys(raisedHandInfo).length === 0) return; const options = { - signalData: raisedHandInfo[promotedListener].signalData, + // signalData: raisedHandInfo[promotedListener].signalData, promoteeAddress: pCAIP10ToWallet( raisedHandInfo[promotedListener].senderAddress ), @@ -102,14 +129,17 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ }, [promotedListener]); const handleAcceptPromotion = async (requesterAddress: any) => { - await spacesObjectRef?.current?.createAudioStream?.(); + // await spacesObjectRef?.current?.createAudioStream?.(); + await performAction({ roomId: spaceData?.spaceId, userId: requesterAddress, canPublish: true }); setPromotedListener(requesterAddress); + await performAction({ roomId: spaceData?.spaceId, userId: requesterAddress, canPublish: true }); }; const handleRejectPromotion = async (requesterAddress: any) => { await spacesObjectRef?.current?.rejectPromotionRequest?.({ promoteeAddress: pCAIP10ToWallet(requesterAddress), }); + await performAction({ roomId: spaceData?.spaceId, userId: requesterAddress, canPublish: false }); }; const handleJoinSpace = async () => { @@ -204,6 +234,8 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ setPlayBackUrl(spaceObjectData?.meta); }, [spaceObjectData?.meta]); + const livekitRoom = useMemo(() => new Room(), []); + return ( <ThemeProvider theme={theme}> <Item @@ -340,54 +372,101 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ justifyContent={'space-between'} padding={'6px 8px'} > - <Item - cursor={'pointer'} - display={'flex'} - alignItems={'center'} - gap={'8px'} - padding={'10px'} - onClick={() => - isHost || isSpeaker ? handleMicState() : handleRequest() - } - > - <Image - width={'14px'} - height={'20px'} - src={ - isHost || isSpeaker - ? isMicOn - ? MicEngagedIcon - : MuteIcon - : isRequestedForMic - ? HandIcon - : MicOnIcon - } - alt="Mic Icon" - /> - <Text - color={`${theme.btnOutline}`} - fontSize={'14px'} - fontWeight={600} + {livekitToken && ( + <LiveKitRoom + serverUrl={LIVEKIT_SERVER_URL} + token={livekitToken} + room={livekitRoom} > + <RoomAudioRenderer /> + <TrackToggleComp source={Track.Source.Microphone} /> {isHost || isSpeaker - ? isMicOn - ? 'Speaking' - : 'Muted' - : isRequestedForMic - ? 'Requested' - : 'Request' + ? + <TrackToggleComp showIcon={false} source={Track.Source.Microphone} > + <Microphone source={Track.Source.Microphone} /> + </TrackToggleComp> + : + <Item + cursor={'pointer'} + display={'flex'} + alignItems={'center'} + gap={'8px'} + padding={'10px'} + onClick={() => handleRequest()} + > + <Image + width={'14px'} + height={'20px'} + src={ + isRequestedForMic + ? HandIcon + : MicOnIcon + } + alt="Mic Icon" + /> + <Text + color={`${theme.btnOutline}`} + fontSize={'14px'} + fontWeight={600} + > + { + isRequestedForMic + ? 'Requested' + : 'Request' + } + </Text> + </Item> } - </Text> - </Item> + </LiveKitRoom> + )} + {/* <Item + cursor={'pointer'} + display={'flex'} + alignItems={'center'} + gap={'8px'} + padding={'10px'} + onClick={() => + isHost || isSpeaker ? handleMicState() : handleRequest() + } + > + <Image + width={'14px'} + height={'20px'} + src={ + isHost || isSpeaker + ? isMicOn + ? MicEngagedIcon + : MuteIcon + : isRequestedForMic + ? HandIcon + : MicOnIcon + } + alt="Mic Icon" + /> + <Text + color={`${theme.btnOutline}`} + fontSize={'14px'} + fontWeight={600} + > + {isHost || isSpeaker + ? isMicOn + ? 'Speaking' + : 'Muted' + : isRequestedForMic + ? 'Requested' + : 'Request' + } + </Text> + </Item> */} <Item display={'flex'} alignItems={'center'} gap={'16px'}> <MembersContainer> - { + {/* { isHost && numberOfRequests ? <RequestsCount> {numberOfRequests} </RequestsCount> : null - } + } */} <Image width={'21px'} height={'24px'} @@ -418,11 +497,11 @@ export const LiveWidgetContent: React.FC<LiveWidgetContentProps> = ({ {!isHost ? 'Leave' : 'End space'} </Button> </Item> - {isListener && !isHost && playBackUrl.length > 0 && ( + {/* {isListener && !isHost && playBackUrl.length > 0 && ( <PeerPlayerDiv> <Player title="spaceAudio" playbackId={playBackUrl} autoPlay /> </PeerPlayerDiv> - )} + )} */} </Item> ) : ( <Button @@ -483,3 +562,14 @@ const RequestsCount = styled.div` border-radius: 4px; font-size: 12px; `; + +const LiveKitComp = styled.div` + background-color: white; + padding: 12px; + margin: 12px; +`; + +const TrackToggleComp = styled(TrackToggle)` + background-color: transparent; + border: none; +`; \ No newline at end of file diff --git a/packages/uiweb/src/lib/components/space/SpaceWidget/Microphone.tsx b/packages/uiweb/src/lib/components/space/SpaceWidget/Microphone.tsx new file mode 100644 index 000000000..ee71aa9b9 --- /dev/null +++ b/packages/uiweb/src/lib/components/space/SpaceWidget/Microphone.tsx @@ -0,0 +1,45 @@ +import React, { useContext } from 'react'; +import { ThemeProvider } from 'styled-components'; +import type { ToggleSource } from '@livekit/components-core'; +import { useTrackToggle, TrackToggleProps } from "@livekit/components-react"; + +import { ThemeContext } from '../theme/ThemeProvider'; + +import { Image, Item, Text } from '../../../config'; +import MicEngagedIcon from '../../../icons/MicEngage.svg'; +import MuteIcon from '../../../icons/Muted.svg'; + +export default function Microphone<T extends ToggleSource>({ showIcon, ...props }: TrackToggleProps<T>) { + const { enabled } = useTrackToggle(props); + const theme = useContext(ThemeContext); + + return ( + <ThemeProvider theme={theme}> + <Item + cursor={'pointer'} + display={'flex'} + alignItems={'center'} + gap={'8px'} + padding={'10px'} + > + <Image + width={'14px'} + height={'20px'} + src={ + enabled + ? MicEngagedIcon + : MuteIcon + } + alt="Mic Icon" + /> + <Text + color={`${theme.btnOutline}`} + fontSize={'14px'} + fontWeight={600} + > + {enabled ? 'Speaking' : 'Muted'} + </Text> + </Item> + </ThemeProvider> + ) +} diff --git a/packages/uiweb/src/lib/components/space/SpaceWidget/ScheduledWidgetContent.tsx b/packages/uiweb/src/lib/components/space/SpaceWidget/ScheduledWidgetContent.tsx index 914742c8e..051782802 100644 --- a/packages/uiweb/src/lib/components/space/SpaceWidget/ScheduledWidgetContent.tsx +++ b/packages/uiweb/src/lib/components/space/SpaceWidget/ScheduledWidgetContent.tsx @@ -68,6 +68,18 @@ export const ScheduledWidgetContent: React.FC<ScheduledWidgetContentProps> = ({ setIsStarted(true); }; + const handleStartSpaceLiveKit = async () => { + setIsLoading(!isLoading); + console.log(spaceStatusState) + + await initSpaceObject?.(spaceData?.spaceId as string); + + setIsLoading(!isLoading); + setIsStarted(true); + + console.log(spaceStatusState) + } + const handleShareTweet = () => { if (!shareUrl) return; const url = shareUrl; @@ -141,17 +153,34 @@ export const ScheduledWidgetContent: React.FC<ScheduledWidgetContentProps> = ({ return { icon, alt }; }; + // useEffect(() => { + // async function startSpace() { + // if (spaceStatusState === SpaceStatus.Live) return; + // if (!spaceObjectData?.connectionData?.local?.stream || !isStarted) return; + // console.log('SPACE STARTING'); + // await spacesObjectRef?.current?.start?.({ + // livepeerApiKey: 'ac9d3e33-56c2-4a22-a328-a08a46fd9356', + // }); + // console.log('SPACE STARTED'); + // setIsStarted(false); + // setSpaceStatusState && setSpaceStatusState(SpaceStatus.Live); + // } + // startSpace(); + // }, [isStarted]); + useEffect(() => { async function startSpace() { if (spaceStatusState === SpaceStatus.Live) return; - if (!spaceObjectData?.connectionData?.local?.stream || !isStarted) return; - console.log('SPACE STARTING'); - await spacesObjectRef?.current?.start?.({ - livepeerApiKey: 'ac9d3e33-56c2-4a22-a328-a08a46fd9356', - }); + if (!isStarted) return; + + await spacesObjectRef?.current?.start?.(); + console.log('SPACE STARTED'); + setIsStarted(false); + setSpaceStatusState && setSpaceStatusState(SpaceStatus.Live); + console.log(spaceStatusState) } startSpace(); }, [isStarted]); @@ -195,7 +224,7 @@ export const ScheduledWidgetContent: React.FC<ScheduledWidgetContentProps> = ({ background={`${theme.btnColorPrimary}`} border={`1px solid ${theme.btnOutline}`} cursor={'pointer'} - onClick={handleStartSpace} + onClick={handleStartSpaceLiveKit} > <Text fontSize="14px" fontWeight={600} color="#fff"> {isLoading ? <CircularProgressSpinner /> : 'Start this Space'} diff --git a/packages/uiweb/src/lib/components/space/SpaceWidget/WidgetContent.tsx b/packages/uiweb/src/lib/components/space/SpaceWidget/WidgetContent.tsx index 2e83d2149..44f6a0d22 100644 --- a/packages/uiweb/src/lib/components/space/SpaceWidget/WidgetContent.tsx +++ b/packages/uiweb/src/lib/components/space/SpaceWidget/WidgetContent.tsx @@ -74,6 +74,7 @@ export const WidgetContent: React.FC<WidgetContentProps> = ({ spaceData={spaceData} isHost={isHost} setSpaceStatusState={setSpaceStatusState} + account={account} /> ) : spaceStatusState === SpaceStatus.Scheduled ? ( <ScheduledWidgetContent diff --git a/packages/uiweb/src/lib/config/constants.ts b/packages/uiweb/src/lib/config/constants.ts index 32782b3ce..6e92322db 100644 --- a/packages/uiweb/src/lib/config/constants.ts +++ b/packages/uiweb/src/lib/config/constants.ts @@ -1,4 +1,4 @@ -import { PushSubTabs } from "../types"; +import { PushSubTabs } from '../types'; export enum ENV { PROD = 'prod', @@ -13,77 +13,104 @@ export const Constants = { ENV, DEFAULT_TITLE: 'Chat with us!', DEFAULT_GREETING_MSG: 'Hi there!', - DEFAULT_PROFILE_PICTURE: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', - + DEFAULT_PROFILE_PICTURE: + 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==', }; +export const ALCHEMY_API_KEY = 'rtkd-a4JWpnViQBZdNCiFBGTJdp5e0R2'; export const NETWORK_DETAILS = { 5: { - network: "goerli", - }, + network: 'goerli', + }, 80001: { - network: "polygon-mumbai", + network: 'polygon-mumbai', }, 1: { - network: "mainnet", - }, - 137: { - network: "polygon-mainnet", + network: 'mainnet', }, - 97: { + 137: { + network: 'polygon-mainnet', }, - 420: { - } -} + 97: {}, + 420: {}, +}; export const CoreContractChainId = { - 'prod' : 1, - 'dev' : 5, - 'staging' : 5, - 'local' :5 -} + prod: 1, + dev: 5, + staging: 5, + local: 5, +}; + +const TESTNET_NETWORK = { + ETHEREUM: 'eip155:5', + POLYGON: 'eip155:80001', + BSC: 'eip155:97', + OPTIMISM: 'eip155:420', + POLYGON_ZK_EVM: 'eip155:1442', +}; +const MAINET_NETWORK = { + ETHEREUM: 'eip155:1', + POLYGON: 'eip155:137', + BSC: 'eip155:56', + OPTIMISM: 'eip155:10', + POLYGON_ZK_EVM: 'eip155:1101', +}; + +export const BLOCKCHAIN_NETWORK = { + prod: MAINET_NETWORK, + dev: TESTNET_NETWORK, + staging: TESTNET_NETWORK, + local: TESTNET_NETWORK, +}; export const allowedNetworks = { - 'prod': [ + prod: [ 1, //for ethereum mainnet 137, //for polygon mainnet 56, // for bnb mainnet - // 10 // for optimism mainnet + 10, // for optimism mainnet + 42161 // for arbitrum mainnet ], - 'dev' : [ + dev: [ 5, // for eth goerli 80001, //for mumbai polygon 97, // bnb testnet - 420 // optimism goerli testnet + 420, // optimism goerli testnet + 421613 // for arbitrum testnet ], - 'staging' : [ + staging: [ // 42, //for kovan 5, // for goerli 80001, //for mumbai polygon - 97 // bnb testnet + 97, // bnb testnet + 420, // optimism goerli testnet + 421613 // for arbitrum testnet ], - 'local' :[ + local: [ 5, // for eth goerli 80001, //for mumbai polygon 97, // bnb testnet - 420 // optimism goerli testnet + 420, // optimism goerli testnet + 421613 // for arbitrum testnet ] } +export const BLOCKNATIVE_PROJECT_ID = '64a44a0fb537407bfe97d24330e4109c'; + export const InfuraAPIKey = '150f25623ae64d08ab7ec7dd0c6b6ee9'; export const PUBLIC_GOOGLE_TOKEN = 'AIzaSyBhUBnCia6zpxY7KcqjghRS1IphinAvKXs'; export const ProfilePicture = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==`; - export const PushSubTabTitle = { REQUESTS: { title: 'Chat request', }, SPAM: { title: 'Spam', - } + }, }; export const chatLimit = 10; @@ -91,4 +118,9 @@ export const requestLimit = 10; export const notificationLimit = 5; export const FILE_ICON = (extension: string) => - `https://cdn.jsdelivr.net/gh/napthedev/file-icons/file/${extension}.svg`; \ No newline at end of file + `https://cdn.jsdelivr.net/gh/napthedev/file-icons/file/${extension}.svg`; + +// Livekit Server URLs +export const LIVEKIT_SERVER_URL = "https://spacev2-demo-17wvllxz.livekit.cloud"; +export const LIVEKIT_SERVER_WEBSOCKET_URL = "wss://spacev2-demo-17wvllxz.livekit.cloud"; +export const LIVEKIT_TOKEN_GENERATOR_SERVER_URL = "https://ms-lk-server.onrender.com"; \ No newline at end of file diff --git a/packages/uiweb/src/lib/context/chatContext.ts b/packages/uiweb/src/lib/context/chatContext.ts index c075f3377..1757a940a 100644 --- a/packages/uiweb/src/lib/context/chatContext.ts +++ b/packages/uiweb/src/lib/context/chatContext.ts @@ -1,4 +1,4 @@ -import { Env,IMessageIPFS, IUser } from "@pushprotocol/restapi"; +import { Env,IMessageIPFS, IUser, SignerType } from "@pushprotocol/restapi"; import { Constants } from "../config"; import { createContext } from "react"; @@ -8,6 +8,8 @@ export interface IChatDataContextValues { setAccount: React.Dispatch<React.SetStateAction<string| null>>; pgpPrivateKey: string | null; setPgpPrivateKey: React.Dispatch<React.SetStateAction<string | null>>; + signer: SignerType | undefined; + setSigner: React.Dispatch<React.SetStateAction<SignerType | undefined>>; env: Env; setEnv: React.Dispatch<React.SetStateAction<Env>>; pushChatSocket: any; @@ -23,6 +25,10 @@ export const initialChatDataContextValues: IChatDataContextValues = { setAccount: () => { /**/ }, + signer: undefined, + setSigner: () => { + /**/ + }, pgpPrivateKey: '', setPgpPrivateKey: () => { /**/ diff --git a/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx b/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx index 278f9f5ca..c18e42e30 100644 --- a/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx +++ b/packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx @@ -6,13 +6,16 @@ import { } from '../context/chatContext'; import { ThemeContext } from '../components/chat/theme/ThemeProvider'; import useGetChatProfile from '../hooks/useGetChatProfile'; -import { IUser } from '@pushprotocol/restapi'; +import { IUser, SignerType } from '@pushprotocol/restapi'; import { IChatTheme, lightChatTheme } from '../components/chat/theme'; +import { getAddressFromSigner } from '../helpers'; + export interface IChatUIProviderProps { children: ReactNode; theme?: IChatTheme; account?: string | null; + signer?: SignerType | undefined; pgpPrivateKey?: string | null; env?: ENV; } @@ -22,10 +25,13 @@ export const ChatUIProvider = ({ account = null, theme, pgpPrivateKey = null, + signer = undefined, env = Constants.ENV.PROD, }: IChatUIProviderProps) => { const [accountVal, setAccountVal] = useState<string | null>(account); - const [pushChatSocket, setPushChatSocket] = useState<any>(null); + const [pushChatSocket, setPushChatSocket] = useState<any>(null); + const [signerVal, setSignerVal] = useState<SignerType| undefined>(signer); + const [pgpPrivateKeyVal, setPgpPrivateKeyVal] = useState<string | null>(pgpPrivateKey); const [envVal, setEnvVal] = useState<ENV>(env); @@ -34,18 +40,28 @@ export const ChatUIProvider = ({ const [isPushChatSocketConnected, setIsPushChatSocketConnected] = useState<boolean>(false); - useEffect(() => { - resetStates(); - setEnvVal(env); - setAccountVal(account); - setPgpPrivateKeyVal(pgpPrivateKey); - }, [env,account,pgpPrivateKey]) + (async()=>{ + resetStates(); + setEnvVal(env); + + if (signer) { + if (!account) { + const address = await getAddressFromSigner(signer); + setAccountVal(address); + } + else{ + setAccountVal(account); + } + } + setSignerVal(signer); + setPgpPrivateKeyVal(pgpPrivateKey); + })() + + }, [env,account,pgpPrivateKey,signer]) + - useEffect(() => { - setAccountVal(account) - }, [account]) @@ -55,19 +71,22 @@ const resetStates = () => { }; + + useEffect(() => { (async () => { let user; if (account) { user = await fetchChatProfile({ profileId: account,env }); - if (user) setConnectedProfile(user); } })(); - }, [account,env]); + }, [account,env,pgpPrivateKey]); const value: IChatDataContextValues = { account: accountVal, + signer:signerVal, + setSigner:setSignerVal, setAccount: setAccountVal, pgpPrivateKey: pgpPrivateKeyVal, setPgpPrivateKey: setPgpPrivateKeyVal, @@ -83,7 +102,6 @@ useEffect(() => { const PROVIDER_THEME = Object.assign({}, lightChatTheme, theme); -console.log(PROVIDER_THEME) return ( <ThemeContext.Provider value={PROVIDER_THEME}> <ChatDataContext.Provider value={value}> diff --git a/packages/uiweb/src/lib/helpers/address.ts b/packages/uiweb/src/lib/helpers/address.ts index 5af01ad2c..d27d7da54 100644 --- a/packages/uiweb/src/lib/helpers/address.ts +++ b/packages/uiweb/src/lib/helpers/address.ts @@ -1,5 +1,6 @@ import { ethers } from 'ethers'; import type { Web3Provider, InfuraProvider } from '@ethersproject/providers'; +import { SignerType } from '@pushprotocol/restapi'; /** * @@ -25,10 +26,14 @@ export const isValidCAIP10NFTAddress = (wallet: string): boolean => { }; export const walletToPCAIP10 = (account:string): string => { - if(isValidCAIP10NFTAddress(account) || account.includes('eip155:')){ - return account + if(account){ + if(isValidCAIP10NFTAddress(account) || account.includes('eip155:')){ + return account + } + return 'eip155:' + account } - return 'eip155:' + account + return account; + } export const pCAIP10ToWallet = (wallet: string): string => { @@ -97,4 +102,12 @@ export const resolveNewEns = async (address: string, provider: InfuraProvider) = export const isPCAIP = (id: string) => { const prefix = `eip155:`; return id?.startsWith(prefix); +}; + +export const getAddressFromSigner = async (signer: SignerType): Promise<string> => { + if ('getAddress' in signer) { + return await signer.getAddress(); + } else { + return signer.account['address'] ?? ''; + } }; \ No newline at end of file diff --git a/packages/uiweb/src/lib/helpers/chat/chat.ts b/packages/uiweb/src/lib/helpers/chat/chat.ts index 357dce16e..81c4ade7d 100644 --- a/packages/uiweb/src/lib/helpers/chat/chat.ts +++ b/packages/uiweb/src/lib/helpers/chat/chat.ts @@ -1,7 +1,12 @@ import * as PushAPI from '@pushprotocol/restapi'; import type { ENV } from '../../config'; import { Constants } from '../../config'; -import type { AccountEnvOptionsType, IGroup, IMessageIPFS, Messagetype } from '../../types'; +import type { + AccountEnvOptionsType, + IGroup, + IMessageIPFS, + Messagetype, +} from '../../types'; import { ChatFeedsType } from '../../types'; import type { Env, IConnectedUser, IFeeds, IUser } from '@pushprotocol/restapi'; import { isPCAIP, pCAIP10ToWallet, walletToPCAIP10 } from '../address'; @@ -18,11 +23,9 @@ type GetChatsType = { supportAddress: string; limit: number; threadHash?: string; - env?: Env; + env?: Env; account: string; -} - - +}; export const handleOnChatIconClick = ({ isModalOpen, @@ -37,13 +40,17 @@ export const createUserIfNecessary = async ( const { account, signer, env = Constants.ENV.PROD } = options || {}; let connectedUser = await PushAPI.user.get({ account: account, env }); if (!connectedUser?.encryptedPrivateKey) { - connectedUser = await PushAPI.user.create({ account: account, signer: signer, env }); + connectedUser = await PushAPI.user.create({ + account: account, + signer: signer, + env, + }); } const decryptedPrivateKey = await PushAPI.chat.decryptPGPKey({ encryptedPGPPrivateKey: connectedUser.encryptedPrivateKey, account, signer, - env + env, }); return { ...connectedUser, privateKey: decryptedPrivateKey }; }; @@ -80,7 +87,7 @@ export const getChats = async ( account: account, pgpPrivateKey: pgpPrivateKey, threadhash: threadhash, - toDecrypt:true, + toDecrypt: true, limit: limit, env, }); @@ -93,19 +100,15 @@ export const getChats = async ( }; type DecrypteChatType = { - message: IMessageIPFS, - connectedUser: IConnectedUser, - env: ENV -} + message: IMessageIPFS; + connectedUser: IConnectedUser; + env: ENV; +}; export const decryptChat = async ( options: DecrypteChatType -):Promise<IMessageIPFS> => { - const { - message, - connectedUser, - env = Constants.ENV.PROD, - } = options || {}; - const decryptedChat:IMessageIPFS[] = await PushAPI.chat.decryptConversation({ +): Promise<IMessageIPFS> => { + const { message, connectedUser, env = Constants.ENV.PROD } = options || {}; + const decryptedChat: IMessageIPFS[] = await PushAPI.chat.decryptConversation({ messages: [message], connectedUser, pgpPrivateKey: connectedUser.privateKey!, @@ -127,8 +130,13 @@ export const copyToClipboard = (address: string): void => { } }; - -export const getDefaultFeedObject = ({user,groupInformation}:{user?:IUser,groupInformation?:IGroup}) :IFeeds => { +export const getDefaultFeedObject = ({ + user, + groupInformation, +}: { + user?: IUser; + groupInformation?: IGroup; +}): IFeeds => { const feed = { msg: { messageContent: '', @@ -144,47 +152,64 @@ export const getDefaultFeedObject = ({user,groupInformation}:{user?:IUser,groupI toDID: '', toCAIP10: '', }, - wallets: groupInformation?null: user!.wallets, - did: groupInformation?null: user!.did, + wallets: groupInformation ? null : user!.wallets, + did: groupInformation ? null : user!.did, threadhash: null, - profilePicture: groupInformation?groupInformation.groupImage:user?.profile.picture, + profilePicture: groupInformation + ? groupInformation.groupImage + : user?.profile.picture, name: null, - about: groupInformation?null:user!.about, + about: groupInformation ? null : user!.about, intent: null, intentSentBy: null, intentTimestamp: new Date(), - publicKey: groupInformation?null: user!.publicKey, + publicKey: groupInformation ? null : user!.publicKey, combinedDID: '', cid: '', - groupInformation: undefined, + groupInformation: groupInformation ?? undefined, }; return feed as IFeeds; -} +}; type CheckIfIntentType = { - chat:IFeeds, - account:string, -} -export const checkIfIntent = ({chat,account}:CheckIfIntentType):boolean => { - console.log(chat) - console.log(account) - if(Object.keys(chat || {}).length && (chat.combinedDID.toLowerCase()).includes(walletToPCAIP10(account).toLowerCase())) - { - if( chat.intent && (chat.intent.toLowerCase()).includes(walletToPCAIP10(account).toLowerCase())) - return false; - else - return true; + chat: IFeeds; + account: string; +}; +export const checkIfIntent = ({ + chat, + account, +}: CheckIfIntentType): boolean => { + if (account) { + if ( + Object.keys(chat || {}).length && + chat.combinedDID + .toLowerCase() + .includes(walletToPCAIP10(account).toLowerCase()) + ) { + if ( + chat.intent && + chat.intent + .toLowerCase() + .includes(walletToPCAIP10(account).toLowerCase()) + ) + return false; + else return true; + } } + return false; -} +}; -export const checkIfUnread = (chatId:string,chat:IFeeds):boolean => { +export const checkIfUnread = (chatId: string, chat: IFeeds): boolean => { const tempChat = getData(chatId); - if(tempChat && tempChat?.msg && (tempChat.msg.timestamp!) < (chat.msg.timestamp!)) - return true; + if ( + tempChat && + tempChat?.msg && + tempChat.msg.timestamp! < chat.msg.timestamp! + ) + return true; return false; -} - +}; export const getChatId = ({ msg, @@ -199,22 +224,25 @@ export const getChatId = ({ return !isPCAIP(msg.toDID) ? msg.toDID : msg.fromDID; }; -export const appendUniqueMessages = (parentList:Messagetype,newlist:IMessageIPFS[],infront:boolean) =>{ +export const appendUniqueMessages = ( + parentList: Messagetype, + newlist: IMessageIPFS[], + infront: boolean +) => { const uniqueMap: { [timestamp: number]: IMessageIPFS } = {}; - const appendedArray = infront?[...newlist, ...parentList.messages]:[ ...parentList.messages,...newlist]; + const appendedArray = infront + ? [...newlist, ...parentList.messages] + : [...parentList.messages, ...newlist]; const newMessageList = Object.values( - appendedArray.reduce( - (uniqueMap, message) => { - if (message.timestamp && !uniqueMap[message.timestamp]) { - uniqueMap[message.timestamp] = message; - } - return uniqueMap; - }, - uniqueMap - ) + appendedArray.reduce((uniqueMap, message) => { + if (message.timestamp && !uniqueMap[message.timestamp]) { + uniqueMap[message.timestamp] = message; + } + return uniqueMap; + }, uniqueMap) ); - return newMessageList -} + return newMessageList; +}; export const checkIfSameChat = ( msg: IMessageIPFS, @@ -223,19 +251,26 @@ export const checkIfSameChat = ( ) => { if (ethers.utils.isAddress(chatId)) { chatId = walletToPCAIP10(chatId); + if ( + Object.keys(msg || {}).length && + (((chatId.toLowerCase() === msg.fromCAIP10?.toLowerCase()) && + ( walletToPCAIP10(account!).toLowerCase() === + msg.toCAIP10?.toLowerCase())) || + ((chatId.toLowerCase() === msg.toCAIP10?.toLowerCase()) && + (walletToPCAIP10(account!).toLowerCase() === + msg.fromCAIP10?.toLowerCase()))) + ) { + return true; + } + } else { + if ( + Object.keys(msg || {}).length && + (chatId.toLowerCase() === msg.toCAIP10?.toLowerCase()) + ) { + return true; + } } - if ( - Object.keys(msg || {}).length && - ((chatId.toLowerCase() === - msg.fromCAIP10?.toLowerCase() && - walletToPCAIP10(account!).toLowerCase() === - msg.toCAIP10?.toLowerCase()) || - (chatId.toLowerCase() === - msg.toCAIP10?.toLowerCase() && - walletToPCAIP10(account!).toLowerCase() === - msg.fromCAIP10?.toLowerCase())) - ) { - return true; - } + console.log(chatId); + return false; -}; \ No newline at end of file +}; diff --git a/packages/uiweb/src/lib/helpers/chat/localStorage.ts b/packages/uiweb/src/lib/helpers/chat/localStorage.ts index 4d7dac903..9ceedaaf9 100644 --- a/packages/uiweb/src/lib/helpers/chat/localStorage.ts +++ b/packages/uiweb/src/lib/helpers/chat/localStorage.ts @@ -61,3 +61,12 @@ export const setPfp = ({ }) => { localStorage.setItem(account, value); }; + +export const setAccessControl = (chatId: string, toRemove: boolean) => { + if (toRemove) { + localStorage.removeItem(chatId); + } else { + const timestamp = new Date().getTime(); + localStorage.setItem(chatId, JSON.stringify(timestamp)); + } +}; diff --git a/packages/uiweb/src/lib/helpers/chat/search.ts b/packages/uiweb/src/lib/helpers/chat/search.ts index cad3ae4c4..ce5448dba 100644 --- a/packages/uiweb/src/lib/helpers/chat/search.ts +++ b/packages/uiweb/src/lib/helpers/chat/search.ts @@ -3,11 +3,17 @@ import { add } from 'date-fns'; import { ethers } from 'ethers'; import { CoreContractChainId, + ENV, InfuraAPIKey, ProfilePicture, } from '../../config'; import type { GetProfileParams } from '../../hooks'; -import type { ChatFeedsType, NotificationFeedsType, ParsedNotificationType, Web3NameListType } from '../../types'; +import type { + ChatFeedsType, + NotificationFeedsType, + ParsedNotificationType, + Web3NameListType, +} from '../../types'; import { pCAIP10ToWallet, walletToPCAIP10 } from '../address'; import { getUdResolver } from '../udResolver'; import { displayDefaultUser } from './user'; @@ -24,15 +30,20 @@ export const getObjectsWithMatchingKeys = ( if (key.toLowerCase().includes(substring.toLowerCase())) { matchedObjects[key] = obj[key]; } else if (obj[key].name) { - if ((obj[key].name?.toLowerCase() as string).includes(substring.toLowerCase())) { + if ( + (obj[key].name?.toLowerCase() as string).includes( + substring.toLowerCase() + ) + ) { matchedObjects[key] = obj[key]; } } else { Object.keys(web3NameList).forEach((key) => { - if (web3NameList[key].toLowerCase().includes(substring.toLowerCase())) { - - if(obj[walletToPCAIP10(key)]) - matchedObjects[walletToPCAIP10(key)] = obj[walletToPCAIP10(key)]; + if ( + web3NameList[key].toLowerCase().includes(substring.toLowerCase()) + ) { + if (obj[walletToPCAIP10(key)]) + matchedObjects[walletToPCAIP10(key)] = obj[walletToPCAIP10(key)]; } }); } @@ -56,10 +67,14 @@ export const getNewChatUser = async ({ }: getNewChatUserParamType): Promise<IUser | undefined> => { let chatProfile: IUser | undefined; let address: string | null = null; - address = await getAddress(searchText, env); + // const provider = new ethers.providers.InfuraProvider(); + // address = await provider.resolveName(searchText); + // if (!address) { + // address = await getAddress(searchText, env); + // } if (address) { - chatProfile = await fetchChatProfile({ profileId: address ,env}); + chatProfile = await fetchChatProfile({ profileId: address, env }); if (!chatProfile) chatProfile = displayDefaultUser({ caip10: walletToPCAIP10(address) }); return chatProfile; @@ -73,16 +88,12 @@ export const getAddress = async (searchText: string, env: Env) => { CoreContractChainId[env], InfuraAPIKey ); - let address: string | null = null; if (searchText.includes('.')) { try { address = - (await udResolver.owner(searchText)) || - (await provider.resolveName(searchText)) ; - // (await library.resolveName(searchText)) || - - + (await udResolver.owner(searchText)) || + (await provider.resolveName(searchText)); return address; } catch (err) { console.log(err); @@ -99,21 +110,18 @@ export const getSearchedNotificationsList = ( substring: string, obj: NotificationFeedsType ) => { - const matchedObjects: Record<string, ParsedNotificationType> = {}; if (substring) { Object.keys(obj).forEach((key) => { - if ((obj[key].app.toLowerCase()).includes(substring.toLowerCase())) { - matchedObjects[key] = obj[key]; - } - else{ - if ((obj[key].title.toLowerCase()).includes(substring.toLowerCase())) { + if (obj[key].app.toLowerCase().includes(substring.toLowerCase())) { matchedObjects[key] = obj[key]; - } - } + } else { + if (obj[key].title.toLowerCase().includes(substring.toLowerCase())) { + matchedObjects[key] = obj[key]; + } + } }); } return matchedObjects; - }; diff --git a/packages/uiweb/src/lib/hooks/chat/index.ts b/packages/uiweb/src/lib/hooks/chat/index.ts index 8aa6ea6bb..d497e66d6 100644 --- a/packages/uiweb/src/lib/hooks/chat/index.ts +++ b/packages/uiweb/src/lib/hooks/chat/index.ts @@ -3,9 +3,9 @@ export * from './useChatData'; export * from './useChatProfile'; export * from './usePushChatSocket'; -export * from './usePushSendMessage'; -export * from './useGetGroupByID'; export * from './useFetchChat'; export * from './useFetchConversationHash'; export * from './usePushSendMessage'; export * from './useGetGroupByID'; +export * from './useAccount'; +export * from './useUpdateGroup'; diff --git a/packages/uiweb/src/lib/hooks/chat/useAccount.ts b/packages/uiweb/src/lib/hooks/chat/useAccount.ts new file mode 100644 index 000000000..396fabb54 --- /dev/null +++ b/packages/uiweb/src/lib/hooks/chat/useAccount.ts @@ -0,0 +1,35 @@ +import { useConnectWallet, useSetChain } from '@web3-onboard/react'; +import { ethers } from 'ethers'; + +export const useAccount = () => { + const [{ wallet, connecting }, connect, disconnect, updateBalances, setWalletModules, setPrimaryWallet] = + useConnectWallet(); + + const [{ chains, connectedChain, settingChain }, setChain] = useSetChain(); + + const isActive = () => { + return wallet && wallet.accounts.length > 0 ? true : false; + }; + + const switchChain = async (desiredChain: number) => { + setChain({ chainId: ethers.utils.hexValue(desiredChain) }); + }; + + return { + wallet, + connecting, + connect, + disconnect, + updateBalances, + setWalletModules, + setPrimaryWallet, + provider: wallet ? new ethers.providers.Web3Provider(wallet.provider, 'any') : undefined, + account: wallet && wallet.accounts.length > 0 ? ethers.utils.getAddress(wallet.accounts[0].address) : undefined, + chainId: connectedChain ? Number(connectedChain.id) : undefined, + isActive, + setChain, + switchChain, + settingChain, + chains, + }; +}; \ No newline at end of file diff --git a/packages/uiweb/src/lib/hooks/chat/useApproveChatRequest.ts b/packages/uiweb/src/lib/hooks/chat/useApproveChatRequest.ts index 474e64735..676705a7f 100644 --- a/packages/uiweb/src/lib/hooks/chat/useApproveChatRequest.ts +++ b/packages/uiweb/src/lib/hooks/chat/useApproveChatRequest.ts @@ -9,7 +9,7 @@ interface ApproveChatParams { const useApproveChatRequest = () => { const [error, setError] = useState<string>(); const [loading, setLoading] = useState<boolean>(false); - const { account, env,pgpPrivateKey } =useChatData(); + const { account, env,pgpPrivateKey,signer } =useChatData(); const approveChatRequest = useCallback(async (options:ApproveChatParams) => { const { @@ -20,10 +20,12 @@ const useApproveChatRequest = () => { const response = await PushAPI.chat.approve({ status: 'Approved', account: account, - senderAddress: chatId, // receiver's address or chatId of a group + senderAddress: chatId, + signer:signer, // receiver's address or chatId of a group pgpPrivateKey:pgpPrivateKey, env: env, }); + setLoading(false); return response; } catch (error: Error | any) { setLoading(false); @@ -32,7 +34,9 @@ const useApproveChatRequest = () => { return; } }, - [] + + [account,env,signer,pgpPrivateKey] + ); return { approveChatRequest, error, loading }; diff --git a/packages/uiweb/src/lib/hooks/chat/useCreateGatedGroup.ts b/packages/uiweb/src/lib/hooks/chat/useCreateGatedGroup.ts new file mode 100644 index 000000000..2ac3701f1 --- /dev/null +++ b/packages/uiweb/src/lib/hooks/chat/useCreateGatedGroup.ts @@ -0,0 +1,43 @@ +import { useCallback, useState } from 'react'; +import { useChatData } from './useChatData'; +import * as PushAPI from '@pushprotocol/restapi'; +import { GrouInfoType } from '../../components/chat/types'; + +export const useCreateGatedGroup = () => { + const [loading, setLoading] = useState<boolean>(false); + const [error, setError] = useState<string>(); + const { pgpPrivateKey, env, account } = useChatData(); + + const createGatedGroup = useCallback( + async (groupInfoType:GrouInfoType,rules: any) => { + setLoading(true); + try { + const payload = { + groupName: groupInfoType.groupName, + groupDescription:groupInfoType.groupDescription, + groupImage:groupInfoType.groupImage, + isPublic: groupInfoType.isPublic, + members: [], + admins: [], + account: account || '', + env: env, + pgpPrivateKey: pgpPrivateKey, + rules: rules, + }; + const response = await PushAPI.chat.createGroup(payload); + setLoading(false); + if (!response) { + return false; + } + return true; + } catch (error: Error | any) { + setLoading(false); + setError(error.message); + return error.message; + } + }, + [pgpPrivateKey, account, env] + ); + + return { createGatedGroup, error, loading }; +}; diff --git a/packages/uiweb/src/lib/hooks/chat/useCriteriaState.ts b/packages/uiweb/src/lib/hooks/chat/useCriteriaState.ts new file mode 100644 index 000000000..e677f4251 --- /dev/null +++ b/packages/uiweb/src/lib/hooks/chat/useCriteriaState.ts @@ -0,0 +1,228 @@ +import { useState } from 'react'; +import { + Condition, + ConditionType, + CriteriaStateType, + Rule, + TokenGatedRule, +} from '../../components/chat/types'; +import { OPERATOR_OPTIONS } from '../../components/chat/constants'; + +export const useCriteriaState = ( + defaultRules: Rule[][], + defaultConditionTypes: ConditionType[] +): CriteriaStateType => { + const [entryRootCondition, setEntryRootCondition] = useState<ConditionType>( + OPERATOR_OPTIONS[1]?.value as ConditionType + ); + const [entryRuleTypeCondition, setEntryRuleTypeCondition] = + useState<ConditionType>(OPERATOR_OPTIONS[1]?.value as ConditionType); + const [entryOptionTypeArray, setEntryOptionTypeArray] = useState< + ConditionType[] + >(defaultConditionTypes); + const [entryOptionsDataArray, setEntryOptionsDataArray] = + useState<Rule[][]>(defaultRules); + + const [selectedCriteria, setSelectedCriteria] = useState(-1); + const [selectedRules, setSelectedRule] = useState<Rule[]>([]); + + const [entryOptionsDataArrayUpdate, setEntryOptionsDataArrayUpdate] = + useState(-1); + const [updateCriteriaIdx, setUpdateCriteriaIdx] = useState(-1); + + const addNewRule = (newRule: Rule) => { + if (selectedCriteria === -1) { + setSelectedCriteria(entryOptionTypeArray.length); + } + + if (updateCriteriaIdx !== -1) { + // update existing + const _rulesToUpdate = [...selectedRules]; + _rulesToUpdate[updateCriteriaIdx] = newRule; + setSelectedRule(_rulesToUpdate); + } else { + // add new + setSelectedRule((prev) => [...prev, newRule]); + } + }; + + const deleteRule = (idx: number) => { + const removedRule = [...selectedRules]; + removedRule.splice(idx, 1); + setSelectedRule(removedRule); + }; + + const addNewCondtion = () => { + if (selectedRules.length > 0) { + setEntryOptionTypeArray((prev) => [...prev, entryRuleTypeCondition]); + setEntryOptionsDataArray((prev) => [...prev, [...selectedRules]]); + } + setSelectedRule([]); + }; + + const updateCondition = () => { + const optionTypeArrayUpdated = [...entryOptionTypeArray]; + optionTypeArrayUpdated[entryOptionsDataArrayUpdate] = + entryRuleTypeCondition; + + const entryOptionsDataArrayUpdated = [...entryOptionsDataArray]; + entryOptionsDataArrayUpdated[entryOptionsDataArrayUpdate] = [ + ...selectedRules, + ]; + + setEntryOptionTypeArray(optionTypeArrayUpdated); + setEntryOptionsDataArray(entryOptionsDataArrayUpdated); + + setSelectedRule([]); + }; + + const isCondtionUpdateEnabled = () => { + return entryOptionsDataArrayUpdate !== -1; + }; + + const deleteEntryOptionsDataArray = (idx: number) => { + const removedRule = [...entryOptionsDataArray]; + removedRule.splice(idx, 1); + setEntryOptionsDataArray(removedRule); + }; + + const selectEntryOptionsDataArrayForUpdate = (idx: number) => { + setEntryOptionsDataArrayUpdate(idx); + }; + + const isUpdateCriteriaEnabled = () => { + return updateCriteriaIdx !== -1; + }; + + return { + entryRootCondition, + setEntryRootCondition, + entryRuleTypeCondition, + setEntryRuleTypeCondition, + entryOptionTypeArray, + setEntryOptionTypeArray, + entryOptionsDataArray, + setEntryOptionsDataArray, + selectedCriteria, + setSelectedCriteria, + addNewCondtion, + selectedRules, + addNewRule, + deleteRule, + deleteEntryOptionsDataArray, + selectEntryOptionsDataArrayForUpdate, + entryOptionsDataArrayUpdate, + isCondtionUpdateEnabled, + updateCondition, + setSelectedRule, + updateCriteriaIdx, + setUpdateCriteriaIdx, + isUpdateCriteriaEnabled, + }; +}; + +export enum SelectedCriteria { + ENTRY, + CHAT, +} + +export interface CriteriaStateManagerType { + entryCriteria: CriteriaStateType; + chatCriteria: CriteriaStateType; + seletedCriteria: SelectedCriteria; + setSelectedCriteria: React.Dispatch<React.SetStateAction<SelectedCriteria>>; + getSelectedCriteria: () => CriteriaStateType; + resetRules: () => void; + resetCriteriaIdx: () => void; + generateRule: () => TokenGatedRule; +} + +export const useCriteriaStateManager = (): CriteriaStateManagerType => { + const [seletedCriteria, setSelectedCriteria] = useState<SelectedCriteria>( + SelectedCriteria.CHAT + ); + const entryCriteria = useCriteriaState( + [ + [ + { + type: 'PUSH', + category: 'INVITE', + subcategory: 'DEFAULT', + data: { + inviterRoles: ['ADMIN', 'OWNER'], + }, + }, + ], + ], + ['all'] + ); + const chatCriteria = useCriteriaState([], []); + + const getSelectedCriteria = () => { + if (seletedCriteria === SelectedCriteria.CHAT) { + return chatCriteria; + } else { + return entryCriteria; + } + }; + + const resetRules = () => { + entryCriteria.selectEntryOptionsDataArrayForUpdate(-1); + entryCriteria.setSelectedRule([]); + chatCriteria.selectEntryOptionsDataArrayForUpdate(-1); + chatCriteria.setSelectedRule([]); + }; + + const resetCriteriaIdx = () => { + entryCriteria.setUpdateCriteriaIdx(-1); + chatCriteria.setUpdateCriteriaIdx(-1); + }; + + const _generate = ( + rules: Rule[][], + conditionTypes: ConditionType[] + ): Condition[] => { + if(rules.length === 0){ + return [] + } + + console.log(`Generating for ${JSON.stringify(rules)}`) + console.log("condition type",conditionTypes); + + return conditionTypes.map((el, idx) => ({ + [el]: rules[idx].map((_el) => _el), + })) as any; + }; + + const generateRule = (): TokenGatedRule => { + return { + entry: { + conditions: { + [entryCriteria.entryRootCondition]: _generate( + entryCriteria.entryOptionsDataArray, + entryCriteria.entryOptionTypeArray + ), + }, + }, + chat: { + conditions: { + [chatCriteria.entryRootCondition]: _generate( + chatCriteria.entryOptionsDataArray, + chatCriteria.entryOptionTypeArray + ), + }, + }, + } as any; + }; + + return { + entryCriteria, + chatCriteria, + seletedCriteria, + setSelectedCriteria, + getSelectedCriteria, + resetRules, + resetCriteriaIdx, + generateRule, + }; +}; diff --git a/packages/uiweb/src/lib/hooks/chat/useFetchChat.ts b/packages/uiweb/src/lib/hooks/chat/useFetchChat.ts index 4a0887956..d1bbd06dc 100644 --- a/packages/uiweb/src/lib/hooks/chat/useFetchChat.ts +++ b/packages/uiweb/src/lib/hooks/chat/useFetchChat.ts @@ -16,11 +16,10 @@ const useFetchChat = () => { const fetchChat = useCallback( async ({ chatId}: fetchChat) => { - console.log(env); setLoading(true); try { const chat = await PushAPI.chat.chat({ - account: account!, + account: account? account : '0xeeE5A266D7cD954bE3Eb99062172E7071E664023', toDecrypt: pgpPrivateKey ? true : false, pgpPrivateKey: String(pgpPrivateKey), recipient: chatId, @@ -37,7 +36,7 @@ const useFetchChat = () => { setLoading(false); } }, - [pgpPrivateKey,env] + [pgpPrivateKey,env,account] ); return { fetchChat, error, loading }; diff --git a/packages/uiweb/src/lib/hooks/chat/useFetchConversationHash.ts b/packages/uiweb/src/lib/hooks/chat/useFetchConversationHash.ts index 407e34576..5b65d4c61 100644 --- a/packages/uiweb/src/lib/hooks/chat/useFetchConversationHash.ts +++ b/packages/uiweb/src/lib/hooks/chat/useFetchConversationHash.ts @@ -18,7 +18,7 @@ const useFetchConversationHash = () => { try { const response = await PushAPI.chat.conversationHash({ conversationId, - account: account!, + account: account ? account : '0xeeE5A266D7cD954bE3Eb99062172E7071E664023', env: env, }); setLoading(false); diff --git a/packages/uiweb/src/lib/hooks/chat/useFetchHistoryMessages.ts b/packages/uiweb/src/lib/hooks/chat/useFetchHistoryMessages.ts index cdd2ee84c..0082622f9 100644 --- a/packages/uiweb/src/lib/hooks/chat/useFetchHistoryMessages.ts +++ b/packages/uiweb/src/lib/hooks/chat/useFetchHistoryMessages.ts @@ -27,7 +27,7 @@ const useFetchHistoryMessages try { const chatHistory:IMessageIPFS[] = await PushAPI.chat.history({ threadhash: threadHash, - account: account!, + account:account ? account : '0xeeE5A266D7cD954bE3Eb99062172E7071E664023', toDecrypt: pgpPrivateKey ? true : false, pgpPrivateKey: String(pgpPrivateKey), limit: limit, diff --git a/packages/uiweb/src/lib/hooks/chat/usePushChatSocket.ts b/packages/uiweb/src/lib/hooks/chat/usePushChatSocket.ts index 7d5484a7c..91d8a737c 100644 --- a/packages/uiweb/src/lib/hooks/chat/usePushChatSocket.ts +++ b/packages/uiweb/src/lib/hooks/chat/usePushChatSocket.ts @@ -2,11 +2,10 @@ import { createSocketConnection, EVENTS } from '@pushprotocol/socket'; import { useCallback, useEffect, useState } from 'react'; import { ENV } from '../../config'; import * as PushAPI from '@pushprotocol/restapi'; -import type { IMessageIPFS } from '@pushprotocol/restapi'; -import { isAccountsEqual } from '../../components/space/helpers/account'; + import { useChatData } from './useChatData'; import { SOCKET_TYPE } from '../../types'; -import { getChatId } from '../../helpers'; +import useGetChatProfile from '../useGetChatProfile'; export type PushChatSocketHookOptions = { account?: string | null; @@ -22,11 +21,14 @@ export const usePushChatSocket = () => { setIsPushChatSocketConnected, isPushChatSocketConnected, connectedProfile, + setConnectedProfile, env, } = useChatData(); - +const {fetchChatProfile} = useGetChatProfile(); const [messagesSinceLastConnection, setMessagesSinceLastConnection] = useState<any>({}); + const [acceptedRequestMessage, setAcceptedRequestMessage] = + useState<any>({}); const [ groupInformationSinceLastConnection, setGroupInformationSinceLastConnection, @@ -48,32 +50,32 @@ export const usePushChatSocket = () => { }); pushChatSocket?.on(EVENTS.CHAT_RECEIVED_MESSAGE, async (chat: any) => { - console.log(chat) - console.log(connectedProfile) - console.log(pgpPrivateKey) + + if (!connectedProfile || !pgpPrivateKey) { return; } - console.log(chat) if ( ( chat.messageCategory === 'Request') && (chat.messageContent === null) && (chat.messageType === null) ) { - return; + setAcceptedRequestMessage(chat); } - console.log(chat) - const response = await PushAPI.chat.decryptConversation({ - messages: [chat], - connectedUser: connectedProfile, - pgpPrivateKey: pgpPrivateKey, - env: env, - }); - console.log(chat) - - if (response && response.length) { - setMessagesSinceLastConnection(response[0]); + else + { + const response = await PushAPI.chat.decryptConversation({ + messages: [chat], + connectedUser: connectedProfile, + pgpPrivateKey: pgpPrivateKey, + env: env, + }); + + if (response && response.length) { + setMessagesSinceLastConnection(response[0]); + } } + }); pushChatSocket?.on(EVENTS.CHAT_GROUPS, (groupInfo: any) => { /** @@ -137,12 +139,13 @@ export const usePushChatSocket = () => { } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [account, env]); + }, [account, env, pgpPrivateKey]); return { pushChatSocket, isPushChatSocketConnected, messagesSinceLastConnection, + acceptedRequestMessage, groupInformationSinceLastConnection, }; }; diff --git a/packages/uiweb/src/lib/hooks/chat/usePushSendMessage.ts b/packages/uiweb/src/lib/hooks/chat/usePushSendMessage.ts index dbba7517d..4c4ff6173 100644 --- a/packages/uiweb/src/lib/hooks/chat/usePushSendMessage.ts +++ b/packages/uiweb/src/lib/hooks/chat/usePushSendMessage.ts @@ -1,8 +1,9 @@ import * as PushAPI from '@pushprotocol/restapi'; import { useCallback, useContext, useState } from 'react'; - +import useVerifyAccessControl from './useVerifyAccessControl'; import { useChatData } from '..'; import { ENV } from '../../config'; +import { setAccessControl } from '../../helpers'; interface SendMessageParams { message: string; @@ -10,7 +11,7 @@ interface SendMessageParams { messageType?: 'Text' | 'Image' | 'File' | 'GIF' | 'MediaEmbed'; } -const usePushSendMessage = () => { +const usePushSendMessage = () => { const [error, setError] = useState<string>(); const [loading, setLoading] = useState<boolean>(false); @@ -33,15 +34,16 @@ const usePushSendMessage = () => { if (!response) { return false; } - return; + return response; } catch (error: Error | any) { + setLoading(false); setError(error.message); console.log(error); - return; + return error.message; } }, - [pgpPrivateKey, account] + [pgpPrivateKey, account,env] ); return { sendMessage, error, loading }; diff --git a/packages/uiweb/src/lib/hooks/chat/useUpdateGroup.ts b/packages/uiweb/src/lib/hooks/chat/useUpdateGroup.ts new file mode 100644 index 000000000..85353d419 --- /dev/null +++ b/packages/uiweb/src/lib/hooks/chat/useUpdateGroup.ts @@ -0,0 +1,52 @@ +import * as PushAPI from '@pushprotocol/restapi'; +import { Env } from '@pushprotocol/restapi'; +import { useCallback, useContext, useState } from 'react'; +import { useChatData } from './useChatData'; +import { IGroup } from '../../types'; + + +interface updateGroupParams { + groupInfo:IGroup; + memberList:Array<string>; + adminList:Array<string>; +} + +const useUpdateGroup = () => { + const [error, setError] = useState<string>(); + const [loading, setLoading] = useState<boolean>(false); + const { account, env,pgpPrivateKey } = useChatData(); + + + const updateGroup = useCallback( + async ({groupInfo,memberList,adminList}: updateGroupParams) => { + setLoading(true); + try { + const updateResponse = await PushAPI.chat.updateGroup({ + chatId: groupInfo?.chatId, + groupName: groupInfo?.groupName, + groupDescription: groupInfo?.groupDescription ?? '', + groupImage: groupInfo?.groupImage, + members: memberList, + admins: adminList, + account: account, + pgpPrivateKey: pgpPrivateKey, + env: env, + }); + return updateResponse; + } catch (error: Error | any) { + setLoading(false); + setError(error.message); + console.log(error); + return; + } + finally { + setLoading(false); + } + }, + [pgpPrivateKey,env,account] + ); + + return { updateGroup, error, loading }; +}; + +export default useUpdateGroup; diff --git a/packages/uiweb/src/lib/hooks/chat/useVerifyAccessControl.ts b/packages/uiweb/src/lib/hooks/chat/useVerifyAccessControl.ts new file mode 100644 index 000000000..4d470796c --- /dev/null +++ b/packages/uiweb/src/lib/hooks/chat/useVerifyAccessControl.ts @@ -0,0 +1,65 @@ +import * as PushAPI from '@pushprotocol/restapi'; +import { useCallback, useState } from 'react'; +import { ENV } from '../../config'; +import { useChatData } from './useChatData'; +import { setAccessControl } from '../../helpers'; + +interface VerifyAccessControlParams { + chatId: string; + did: string; +} + +const useVerifyAccessControl = () => { + const [error, setError] = useState<string>(); + const [loading, setLoading] = useState<boolean>(false); + const [verificationSuccessfull, setVerificationSuccessfull] = + useState<boolean>(true); + const [verified, setVerified] = useState<boolean>(false); + + const { pgpPrivateKey, env, account } = useChatData(); + + const verifyAccessControl = useCallback( + async (options: VerifyAccessControlParams) => { + const { chatId, did } = options || {}; + setLoading(true); + try { + const response = await PushAPI.chat.getGroupAccess({ + chatId: chatId, + did: `eip155:${did}`, + env: env, + }); + setLoading(false); + if (response.chat === false) { + console.log('in hereeeee response false') + setVerificationSuccessfull(false); + } else if (response.chat === true) { + setVerified(true); + setAccessControl(chatId, false); + } + if (!response) { + return false; + } + return; + } catch (error: Error | any) { + setLoading(false); + setVerificationSuccessfull(false); + setError(error.message); + console.log(error); + return; + } + }, + [pgpPrivateKey, account, env] + ); + + return { + verifyAccessControl, + error, + loading, + verificationSuccessfull, + setVerificationSuccessfull, + verified, + setVerified, + }; +}; + +export default useVerifyAccessControl; diff --git a/packages/uiweb/src/lib/hooks/index.ts b/packages/uiweb/src/lib/hooks/index.ts index 35a59c29f..0da0a8f8c 100644 --- a/packages/uiweb/src/lib/hooks/index.ts +++ b/packages/uiweb/src/lib/hooks/index.ts @@ -7,4 +7,7 @@ export * from './chat'; export * from './chatAndNotification'; export * from './useDivOffsetWidth'; export * from './useDeviceWidthCheck'; -export * from './useGetChatProfile'; \ No newline at end of file +export * from './useGetChatProfile'; +export * from './useMediaQuery'; +export * from './useCreateChatProfile'; +export * from './useDecryptPGPKey'; \ No newline at end of file diff --git a/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts b/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts new file mode 100644 index 000000000..fea956c0e --- /dev/null +++ b/packages/uiweb/src/lib/hooks/useCreateChatProfile.ts @@ -0,0 +1,33 @@ +import * as PushAPI from '@pushprotocol/restapi'; +import { useCallback, useContext } from 'react'; +import { SignerType } from '@pushprotocol/restapi'; + +export interface CreateChatProfileParams { + signer: SignerType | undefined; + env:PushAPI.Env +} + +const useCreateChatProfile = () => { + const creteChatProfile = useCallback( + async ({ + signer, + env + }: CreateChatProfileParams): Promise<PushAPI.IUser | undefined> => { + try { + const profile = await PushAPI.user.create({ + env: env, + signer: signer, + }); + return profile; + } catch (error) { + console.log(error); + return; + } + }, + [] + ); + + return { creteChatProfile }; +}; + +export default useCreateChatProfile; diff --git a/packages/uiweb/src/lib/hooks/useDecryptPGPKey.ts b/packages/uiweb/src/lib/hooks/useDecryptPGPKey.ts new file mode 100644 index 000000000..b5fe1ff37 --- /dev/null +++ b/packages/uiweb/src/lib/hooks/useDecryptPGPKey.ts @@ -0,0 +1,39 @@ +import * as PushAPI from '@pushprotocol/restapi'; +import { useCallback, useContext } from 'react'; +import { SignerType } from '@pushprotocol/restapi'; + +export interface DecryptPGPKeyParams { + account: string; + signer: SignerType | undefined; + encryptedPrivateKey: string; + env:PushAPI.Env +} + +const useDecryptPGPKey = () => { + const decryptPGPKey = useCallback( + async ({ + account, + encryptedPrivateKey, + signer, + env + }: DecryptPGPKeyParams): Promise<string | undefined> => { + try { + const decryptPgpKey = await PushAPI.chat.decryptPGPKey({ + encryptedPGPPrivateKey: encryptedPrivateKey, + account: account!, + signer: signer, + env: env, + }); + return decryptPgpKey; + } catch (error) { + console.log(error); + return; + } + }, + [] + ); + + return { decryptPGPKey }; +}; + +export default useDecryptPGPKey; diff --git a/packages/uiweb/src/lib/components/chat/helpers/useMediaQuery.ts b/packages/uiweb/src/lib/hooks/useMediaQuery.ts similarity index 100% rename from packages/uiweb/src/lib/components/chat/helpers/useMediaQuery.ts rename to packages/uiweb/src/lib/hooks/useMediaQuery.ts diff --git a/packages/uiweb/src/lib/icons/Arbitrum.tsx b/packages/uiweb/src/lib/icons/Arbitrum.tsx new file mode 100644 index 000000000..ac83fac75 --- /dev/null +++ b/packages/uiweb/src/lib/icons/Arbitrum.tsx @@ -0,0 +1,20 @@ +export const Arbitrum = () => { + return ( + <svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_19674_35308)"> + <circle cx="12.5" cy="12" r="12" fill="#2D374B" /> + <path d="M14.2712 11.2019L15.4256 9.24322L18.5369 14.0892L18.5383 15.0192L18.5282 8.61964C18.5208 8.46321 18.4378 8.32009 18.3052 8.23571L12.7037 5.01361C12.5727 4.94922 12.4065 4.94991 12.2757 5.01561C12.258 5.02449 12.2414 5.0341 12.2256 5.04458L12.206 5.05688L6.76883 8.20771L6.74771 8.21727C6.72059 8.22976 6.69318 8.24561 6.66742 8.26405C6.56435 8.338 6.49587 8.44731 6.47372 8.56994C6.47041 8.58852 6.46797 8.60745 6.4668 8.62652L6.47533 13.8416L9.3734 9.34971C9.73826 8.75407 10.5332 8.56223 11.2712 8.57267L12.1374 8.59555L7.03399 16.7799L7.63557 17.1263L12.8001 8.60384L15.0828 8.59555L9.93162 17.3331L12.0782 18.5677L12.3347 18.7152C12.4432 18.7593 12.5711 18.7615 12.6805 18.7221L18.3608 15.4303L17.2748 16.0595L14.2712 11.2019ZM14.7116 17.5449L12.5435 14.1421L13.867 11.8962L16.7144 16.3843L14.7116 17.5449Z" fill="#2D374B" /> + <path d="M12.543 14.142L14.7111 17.5448L16.714 16.3842L13.8665 11.8961L12.543 14.142Z" fill="#28A0F0" /> + <path d="M18.5386 15.0192L18.5371 14.0893L15.4258 9.24326L14.2715 11.2019L17.2751 16.0596L18.3611 15.4303C18.4676 15.3438 18.532 15.2168 18.5388 15.0798L18.5386 15.0192Z" fill="#28A0F0" /> + <path d="M5.50005 15.8962L7.03364 16.7799L12.137 8.59554L11.2709 8.57267C10.5329 8.56223 9.73795 8.75407 9.37304 9.3497L6.47498 13.8415L5.5 15.3396V15.8962H5.50005Z" fill="white" /> + <path d="M15.082 8.59558L12.7993 8.60387L7.63477 17.1263L9.4399 18.1657L9.93081 17.3331L15.082 8.59558Z" fill="white" /> + <path d="M19.4999 8.58377C19.4809 8.10637 19.2224 7.66932 18.8175 7.41489L13.1425 4.15138C12.742 3.94969 12.2416 3.94944 11.8405 4.15124C11.7931 4.17514 6.32167 7.34836 6.32167 7.34836C6.24597 7.38465 6.17304 7.42792 6.10441 7.47699C5.74296 7.73605 5.52263 8.13857 5.5 8.58084V15.3396L6.47498 13.8416L6.46644 8.62655C6.46761 8.60747 6.47 8.58874 6.47337 8.57021C6.49537 8.44748 6.5639 8.33802 6.66707 8.26407C6.69282 8.24564 12.2576 5.02451 12.2754 5.01564C12.4062 4.94993 12.5724 4.94925 12.7033 5.01364L18.3049 8.23573C18.4374 8.32012 18.5205 8.46324 18.5278 8.61967V15.0798C18.5211 15.2168 18.4669 15.3438 18.3604 15.4303L17.2744 16.0596L16.7141 16.3843L14.7112 17.545L12.6801 18.7221C12.5707 18.7616 12.4428 18.7594 12.3343 18.7153L9.93121 17.3331L9.44031 18.1656L11.5999 19.409C11.6713 19.4496 11.735 19.4856 11.7872 19.515C11.8681 19.5603 11.9231 19.5906 11.9426 19.6C12.0961 19.6746 12.3169 19.718 12.5159 19.718C12.6984 19.718 12.8763 19.6845 13.0447 19.6185L18.9442 16.202C19.2828 15.9396 19.482 15.544 19.4999 15.1154V8.58377Z" fill="#96BEDC" /> + </g> + <defs> + <clipPath id="clip0_19674_35308"> + <rect width="24" height="24" fill="white" transform="translate(0.5)" /> + </clipPath> + </defs> + </svg> + ) +} \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/ArbitrumSvg.tsx b/packages/uiweb/src/lib/icons/ArbitrumSvg.tsx new file mode 100644 index 000000000..5703e7717 --- /dev/null +++ b/packages/uiweb/src/lib/icons/ArbitrumSvg.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; + +export const ArbitrumSvg = () => ( + <svg + id="Layer_1" + xmlns="http://www.w3.org/2000/svg" + x={0} + y={0} + viewBox="0 0 1080 1218.5" + xmlSpace="preserve" + > + <style>{'.st0{fill:#1b4add}'}</style> + <path + className="st0" + d="M541.8 76.4c2.9 0 5.8.8 8.4 2.3l446.1 259.5c5.2 3 8.4 8.6 8.3 14.5l-1.7 516.1c0 6-3.2 11.5-8.4 14.5l-447.8 256.6c-2.5 1.5-5.5 2.2-8.4 2.2-2.9 0-5.8-.8-8.4-2.3L83.8 880.3c-5.2-3-8.4-8.6-8.3-14.5l1.7-516.1c0-6 3.2-11.5 8.4-14.5L533.4 78.6c2.5-1.5 5.4-2.2 8.4-2.2M542 1c-15.9-.1-31.8 4-46.1 12.2L48.1 269.7c-28.6 16.4-46.2 46.7-46.4 79.7L0 865.5c-.1 32.9 17.4 63.4 45.8 80L491.9 1205c14.2 8.3 30.1 12.4 46.1 12.5 15.9.1 31.8-4 46.1-12.2l447.8-256.6c28.6-16.4 46.2-46.7 46.4-79.7l1.7-516c.1-32.9-17.4-63.4-45.8-80L588.1 13.5C573.8 5.2 557.9 1 542 1z" + /> + <path + className="st0" + d="M632.4 282.3H567c-4.9 0-9.3 3.1-11 7.7L345.8 866.4c-1.4 3.8 1.4 7.8 5.5 7.8h65.4c4.9 0 9.3-3.1 11-7.7L638 290c1.2-3.7-1.6-7.7-5.6-7.7zm-114.4 0h-65.4c-4.9 0-9.3 3.1-11 7.7L231.4 866.4c-1.4 3.8 1.4 7.8 5.5 7.8h65.4c4.9 0 9.3-3.1 11-7.7L523.6 290c1.3-3.7-1.5-7.7-5.6-7.7zm84.7 223.5c-1.9-5.1-9.1-5.1-11 0l-34 93.2c-.9 2.6-.9 5.4 0 8l94.7 259.6c1.7 4.6 6.1 7.7 11 7.7h65.4c4.1 0 6.9-4 5.5-7.8L602.7 505.8zm245.9 360.6L659.9 349.1c-1.9-5.1-9.1-5.1-11 0l-34 93.2c-.9 2.6-.9 5.4 0 8l151.9 416.3c1.7 4.6 6.1 7.7 11 7.7h65.4c3.9-.1 6.8-4.1 5.4-7.9z" + /> + </svg> +); + diff --git a/packages/uiweb/src/lib/icons/ArrowLeft.svg b/packages/uiweb/src/lib/icons/ArrowLeft.svg deleted file mode 100644 index de2987515..000000000 --- a/packages/uiweb/src/lib/icons/ArrowLeft.svg +++ /dev/null @@ -1,4 +0,0 @@ -<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> -<path d="M16.875 10H3.125" stroke="#82828A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> -<path d="M8.75 4.375L3.125 10L8.75 15.625" stroke="#82828A" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> -</svg> diff --git a/packages/uiweb/src/lib/icons/Back.tsx b/packages/uiweb/src/lib/icons/Back.tsx index f46cb41d3..b210749db 100644 --- a/packages/uiweb/src/lib/icons/Back.tsx +++ b/packages/uiweb/src/lib/icons/Back.tsx @@ -2,8 +2,10 @@ import React from 'react'; export const BackIcon = () => { return ( - <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> - <path d="M16 7H3.83L9.42 1.41L8 0L0 8L8 16L9.41 14.59L3.83 9H16V7Z" fill="#62626A"/> + <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M27 16H5" stroke="#657795" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> + <path d="M14 7L5 16L14 25" stroke="#657795" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> </svg> + ); }; \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/Bsc.tsx b/packages/uiweb/src/lib/icons/Bsc.tsx new file mode 100644 index 000000000..ee60e25ec --- /dev/null +++ b/packages/uiweb/src/lib/icons/Bsc.tsx @@ -0,0 +1,17 @@ + +export const BSC = () => { + return ( + <svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_19674_35302)"> + <circle cx="12.5" cy="12" r="12" fill="#1D1D1D" /> + <path d="M8.66193 12.0002L7.08295 13.5792L5.5 12.0002L7.07898 10.4213L8.66193 12.0002ZM12.5 8.16218L15.2085 10.8707L16.7875 9.29172L12.5 5.00024L8.20852 9.29172L9.7875 10.8707L12.5 8.16218ZM17.917 10.4213L16.3381 12.0002L17.917 13.5792L19.496 12.0002L17.917 10.4213ZM12.5 15.8383L9.79148 13.1298L8.2125 14.7088L12.5 19.0002L16.7875 14.7088L15.2085 13.1298L12.5 15.8383ZM12.5 13.5792L14.079 12.0002L12.5 10.4213L10.917 12.0002L12.5 13.5792Z" fill="#F0B90B" /> + </g> + <defs> + <clipPath id="clip0_19674_35302"> + <rect width="24" height="24" fill="white" transform="translate(0.5)" /> + </clipPath> + </defs> + </svg> + + ) +} \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/CaretUp.svg b/packages/uiweb/src/lib/icons/CaretUp.svg index 852d9acae..944d5cb5a 100644 --- a/packages/uiweb/src/lib/icons/CaretUp.svg +++ b/packages/uiweb/src/lib/icons/CaretUp.svg @@ -1,3 +1,3 @@ -<svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg" transform="rotate(180)"> -<path d="M25.5113 13.272L25.5114 13.2721L25.5173 13.2656C25.6713 13.0939 25.7538 12.8686 25.7499 12.6375C25.7459 12.4064 25.6558 12.1841 25.4959 12.0179C25.3356 11.8515 25.1174 11.7544 24.8867 11.7501C24.6559 11.7459 24.4344 11.835 24.2683 11.9957L24.2682 11.9956L24.2621 12.0019L16.5 20.0625L8.73789 12.0019L8.738 12.0018L8.73166 11.9957C8.56563 11.835 8.34408 11.7459 8.11332 11.7501C7.88259 11.7544 7.6644 11.8515 7.50414 12.0179C7.34416 12.1841 7.25406 12.4064 7.25013 12.6375C7.24621 12.8686 7.32869 13.0939 7.48273 13.2656L7.48262 13.2657L7.48873 13.272L15.8754 21.9823L15.8755 21.9825C16.0395 22.1526 16.2639 22.25 16.5 22.25C16.7361 22.25 16.9605 22.1526 17.1245 21.9825L17.1246 21.9823L25.5113 13.272Z" fill="white" stroke="white" stroke-width="0.5"/> +<svg width="16" height="9" viewBox="0 0 16 9" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M6.9906 8.60023L0.418792 2.32688C-0.139597 1.79385 -0.139597 0.932801 0.418792 0.399772C0.977181 -0.133258 1.87919 -0.133258 2.43758 0.399772L8.00716 5.70273L13.5624 0.399772C14.1208 -0.133258 15.0228 -0.133258 15.5812 0.399772C16.1396 0.932801 16.1396 1.79385 15.5812 2.32688L9.0094 8.60023C8.46532 9.13326 7.54899 9.13326 6.9906 8.60023Z" fill="#B4B4B4"/> </svg> diff --git a/packages/uiweb/src/lib/icons/EditSvg.svg b/packages/uiweb/src/lib/icons/EditSvg.svg new file mode 100644 index 000000000..421ac7e02 --- /dev/null +++ b/packages/uiweb/src/lib/icons/EditSvg.svg @@ -0,0 +1,4 @@ +<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M5.00899 15H1.60869C1.44726 15 1.29243 14.9359 1.17828 14.8217C1.06413 14.7076 1 14.5527 1 14.3913V10.991C1.00007 10.8298 1.06411 10.6752 1.17804 10.5611L10.561 1.17814C10.6752 1.06407 10.8299 1 10.9913 1C11.1527 1 11.3074 1.06407 11.4216 1.17814L14.8219 4.57616C14.9359 4.6903 15 4.84506 15 5.00643C15 5.16779 14.9359 5.32256 14.8219 5.4367L5.43888 14.822C5.32482 14.9359 5.17021 14.9999 5.00899 15Z" stroke="rgba(120, 126, 153, 1)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> +<path d="M8.30469 3.43481L12.5655 7.69565" stroke="rgba(120, 126, 153, 1)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> +</svg> diff --git a/packages/uiweb/src/lib/icons/Emoji.tsx b/packages/uiweb/src/lib/icons/Emoji.tsx index cb9a9dbfc..748bceb64 100644 --- a/packages/uiweb/src/lib/icons/Emoji.tsx +++ b/packages/uiweb/src/lib/icons/Emoji.tsx @@ -4,9 +4,9 @@ type EmojiIconsProps = { color?: string; } -export const EmojiIcon: React.FC<EmojiIconsProps> = ({color="none"}) => { +export const EmojiIcon: React.FC<EmojiIconsProps> = ({color="#494D5F"}) => { return ( - <svg width="30" height="30" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg"> + <svg width="25" height="25" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M16 28.7407C22.6274 28.7407 28 23.2686 28 16.5185C28 9.76831 22.6274 4.29623 16 4.29623C9.37258 4.29623 4 9.76831 4 16.5185C4 23.2686 9.37258 28.7407 16 28.7407Z" stroke={color} stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> <path d="M11.5 15.5C12.3284 15.5 13 14.8159 13 13.9722C13 13.1284 12.3284 12.4444 11.5 12.4444C10.6716 12.4444 10 13.1284 10 13.9722C10 14.8159 10.6716 15.5 11.5 15.5Z" fill={color} /> <path d="M20.5 15.5C21.3284 15.5 22 14.8159 22 13.9722C22 13.1284 21.3284 12.4444 20.5 12.4444C19.6716 12.4444 19 13.1284 19 13.9722C19 14.8159 19.6716 15.5 20.5 15.5Z" fill={color} /> diff --git a/packages/uiweb/src/lib/icons/Ethereum.tsx b/packages/uiweb/src/lib/icons/Ethereum.tsx new file mode 100644 index 000000000..1609f9582 --- /dev/null +++ b/packages/uiweb/src/lib/icons/Ethereum.tsx @@ -0,0 +1,21 @@ +export const EthereumIcon = () => { + return ( + <svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_19674_35283)"> + <path d="M12.5 24C19.1274 24 24.5 18.6274 24.5 12C24.5 5.37258 19.1274 0 12.5 0C5.87258 0 0.5 5.37258 0.5 12C0.5 18.6274 5.87258 24 12.5 24Z" fill="#627EEA" /> + <path d="M12.873 3V9.6525L18.4958 12.165L12.873 3Z" fill="white" fill-opacity="0.602" /> + <path d="M12.8735 3L7.25 12.165L12.8735 9.6525V3Z" fill="white" /> + <path d="M12.873 16.476V20.9963L18.4995 13.212L12.873 16.476Z" fill="white" fill-opacity="0.602" /> + <path d="M12.8735 20.9962V16.4752L7.25 13.212L12.8735 20.9962Z" fill="white" /> + <path d="M12.873 15.4298L18.4958 12.1651L12.873 9.65405V15.4298Z" fill="white" fill-opacity="0.2" /> + <path d="M7.25 12.165L12.8735 15.4297V9.65399L7.25 12.165Z" fill="white" fill-opacity="0.602" /> + </g> + <defs> + <clipPath id="clip0_19674_35283"> + <rect width="24" height="24" fill="white" transform="translate(0.5)" /> + </clipPath> + </defs> + </svg> + + ) +} \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/MoreDark.tsx b/packages/uiweb/src/lib/icons/MoreDark.tsx index 3f20f22fd..68f70fead 100644 --- a/packages/uiweb/src/lib/icons/MoreDark.tsx +++ b/packages/uiweb/src/lib/icons/MoreDark.tsx @@ -1,11 +1,11 @@ import React from 'react'; -export const MoreDarkIcon = () => { +export const MoreDarkIcon = ({color}:{color?:string}) => { return ( <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" cursor="pointer"> - <path d="M16 10C17.1046 10 18 9.10457 18 8C18 6.89543 17.1046 6 16 6C14.8954 6 14 6.89543 14 8C14 9.10457 14.8954 10 16 10Z" fill="#787E99"/> - <path d="M16 18C17.1046 18 18 17.1046 18 16C18 14.8954 17.1046 14 16 14C14.8954 14 14 14.8954 14 16C14 17.1046 14.8954 18 16 18Z" fill="#787E99"/> - <path d="M16 26C17.1046 26 18 25.1046 18 24C18 22.8954 17.1046 22 16 22C14.8954 22 14 22.8954 14 24C14 25.1046 14.8954 26 16 26Z" fill="#787E99"/> + <path d="M16 10C17.1046 10 18 9.10457 18 8C18 6.89543 17.1046 6 16 6C14.8954 6 14 6.89543 14 8C14 9.10457 14.8954 10 16 10Z" fill={color??"#787E99"}/> + <path d="M16 18C17.1046 18 18 17.1046 18 16C18 14.8954 17.1046 14 16 14C14.8954 14 14 14.8954 14 16C14 17.1046 14.8954 18 16 18Z" fill={color??"#787E99"}/> + <path d="M16 26C17.1046 26 18 25.1046 18 24C18 22.8954 17.1046 22 16 22C14.8954 22 14 22.8954 14 24C14 25.1046 14.8954 26 16 26Z" fill={color??"#787E99"}/> </svg> ); }; diff --git a/packages/uiweb/src/lib/icons/MoreLight.tsx b/packages/uiweb/src/lib/icons/MoreLight.tsx index 4aa3f66ea..e208c2191 100644 --- a/packages/uiweb/src/lib/icons/MoreLight.tsx +++ b/packages/uiweb/src/lib/icons/MoreLight.tsx @@ -1,11 +1,15 @@ import React from 'react'; -export const MoreLightIcon = () => { +export const MoreLightIcon = ({ + fill, +}: { + fill?: string; +}) => { return ( <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" cursor="pointer"> - <path d="M16 10C17.1046 10 18 9.10457 18 8C18 6.89543 17.1046 6 16 6C14.8954 6 14 6.89543 14 8C14 9.10457 14.8954 10 16 10Z" fill="black"/> - <path d="M16 18C17.1046 18 18 17.1046 18 16C18 14.8954 17.1046 14 16 14C14.8954 14 14 14.8954 14 16C14 17.1046 14.8954 18 16 18Z" fill="black"/> - <path d="M16 26C17.1046 26 18 25.1046 18 24C18 22.8954 17.1046 22 16 22C14.8954 22 14 22.8954 14 24C14 25.1046 14.8954 26 16 26Z" fill="black"/> + <path d="M16 10C17.1046 10 18 9.10457 18 8C18 6.89543 17.1046 6 16 6C14.8954 6 14 6.89543 14 8C14 9.10457 14.8954 10 16 10Z" fill={fill}/> + <path d="M16 18C17.1046 18 18 17.1046 18 16C18 14.8954 17.1046 14 16 14C14.8954 14 14 14.8954 14 16C14 17.1046 14.8954 18 16 18Z" fill={fill}/> + <path d="M16 26C17.1046 26 18 25.1046 18 24C18 22.8954 17.1046 22 16 22C14.8954 22 14 22.8954 14 24C14 25.1046 14.8954 26 16 26Z" fill={fill}/> </svg> ); }; diff --git a/packages/uiweb/src/lib/icons/OpenLink.tsx b/packages/uiweb/src/lib/icons/OpenLink.tsx new file mode 100644 index 000000000..a5f7decf3 --- /dev/null +++ b/packages/uiweb/src/lib/icons/OpenLink.tsx @@ -0,0 +1,16 @@ +import React from 'react' + +interface OpenLinkProps { + height?: string; + width?: string; +} + +const OpenLink = ({height="8", width="8"}) => { + return ( + <svg width={width} height={height} viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M0.130244 7.24089L6.48282 0.888862H1.77797C1.6601 0.888862 1.54706 0.842038 1.46371 0.758691C1.38036 0.675344 1.33354 0.562301 1.33354 0.444431C1.33354 0.32656 1.38036 0.213518 1.46371 0.130171C1.54706 0.0468235 1.6601 4.76837e-07 1.77797 4.76837e-07H7.55557C7.67344 4.76837e-07 7.78648 0.0468235 7.86983 0.130171C7.95318 0.213518 8 0.32656 8 0.444431V6.22203C8 6.3399 7.95318 6.45294 7.86983 6.53629C7.78648 6.61964 7.67344 6.66646 7.55557 6.66646C7.4377 6.66646 7.32466 6.61964 7.24131 6.53629C7.15796 6.45294 7.11114 6.3399 7.11114 6.22203V1.51718L0.759113 7.86976C0.717821 7.91105 0.6688 7.9438 0.61485 7.96615C0.560899 7.9885 0.503074 8 0.444678 8C0.386282 8 0.328458 7.9885 0.274508 7.96615C0.220557 7.9438 0.171535 7.91105 0.130244 7.86976C0.0889516 7.82846 0.0561972 7.77944 0.0338502 7.72549C0.0115027 7.67154 4.76837e-07 7.61372 4.76837e-07 7.55532C4.76837e-07 7.49693 0.0115027 7.4391 0.0338502 7.38515C0.0561972 7.3312 0.0889516 7.28218 0.130244 7.24089Z" fill="#D53A94" /> + </svg> + ) +} + +export default OpenLink \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/PolygonIcon.tsx b/packages/uiweb/src/lib/icons/PolygonIcon.tsx new file mode 100644 index 000000000..7f2fdffd1 --- /dev/null +++ b/packages/uiweb/src/lib/icons/PolygonIcon.tsx @@ -0,0 +1,16 @@ +export const PolygonIcon = () => { + return ( + <svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_19674_35297)"> + <path d="M12.5 24C19.1274 24 24.5 18.6274 24.5 12C24.5 5.37258 19.1274 0 12.5 0C5.87258 0 0.5 5.37258 0.5 12C0.5 18.6274 5.87258 24 12.5 24Z" fill="#7B3FE4" /> + <path d="M20.5 12.2801V15.9003C20.4987 16.1261 20.4391 16.3476 20.3269 16.5433C20.2147 16.739 20.0538 16.9021 19.86 17.0168L16.735 18.8231C16.5415 18.9389 16.3203 19 16.095 19C15.8697 19 15.6485 18.9389 15.455 18.8231L12.33 17.0168C12.1362 16.9021 11.9753 16.739 11.8631 16.5433C11.751 16.3476 11.6913 16.1261 11.69 15.9003V14.8843L13.29 13.9522V15.7184L16.09 17.3492L18.89 15.7184V12.4645L16.09 10.8337L9.53001 14.6472C9.33465 14.7576 9.11421 14.8157 8.88999 14.8157C8.66577 14.8157 8.44536 14.7576 8.25 14.6472L5.12499 12.8333C4.93416 12.7169 4.77639 12.5532 4.66692 12.3579C4.55745 12.1625 4.49997 11.9422 4.5 11.7181V8.09786C4.50129 7.87211 4.56096 7.65056 4.67313 7.45487C4.78533 7.25918 4.94619 7.09604 5.13999 6.98144L8.265 5.17508C8.45895 5.06045 8.67993 5 8.90499 5C9.13008 5 9.35106 5.06045 9.54501 5.17508L12.67 6.98144C12.8638 7.09604 13.0247 7.25918 13.1368 7.45487C13.2491 7.65056 13.3087 7.87211 13.31 8.09786V9.11393L11.7 10.0397V8.28353L8.90001 6.65279L6.09999 8.28353V11.5337L8.90001 13.1644L15.46 9.35102C15.6553 9.24056 15.8758 9.18254 16.1 9.18254C16.3242 9.18254 16.5446 9.24056 16.74 9.35102L19.865 11.1649C20.0577 11.2801 20.2174 11.4433 20.3287 11.6386C20.44 11.8341 20.499 12.055 20.5 12.2801Z" fill="white" /> + </g> + <defs> + <clipPath id="clip0_19674_35297"> + <rect width="24" height="24" fill="white" transform="translate(0.5)" /> + </clipPath> + </defs> + </svg> + + ) +} \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/RemoveSvg.svg b/packages/uiweb/src/lib/icons/RemoveSvg.svg new file mode 100644 index 000000000..747fac136 --- /dev/null +++ b/packages/uiweb/src/lib/icons/RemoveSvg.svg @@ -0,0 +1,4 @@ +<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M6 9H12" stroke="rgba(120, 126, 153, 1)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> +<path d="M9 17C13.4183 17 17 13.4183 17 9C17 4.58172 13.4183 1 9 1C4.58172 1 1 4.58172 1 9C1 13.4183 4.58172 17 9 17Z" stroke="rgba(120, 126, 153, 1)" stroke-width="2" stroke-miterlimit="10"/> +</svg> diff --git a/packages/uiweb/src/lib/icons/SpamIcon.tsx b/packages/uiweb/src/lib/icons/SpamIcon.tsx new file mode 100644 index 000000000..3e25d871e --- /dev/null +++ b/packages/uiweb/src/lib/icons/SpamIcon.tsx @@ -0,0 +1,8 @@ +export const SpamIcon = ({ color }: { color?: string }) => { + return ( + <svg width="16" height="16" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M8.15234 6.10618C8.15234 5.63757 8.53222 5.25769 9.00083 5.25769C9.46943 5.25769 9.84931 5.63757 9.84931 6.10618C9.84931 6.57478 9.46943 6.95466 9.00083 6.95466C8.53222 6.95466 8.15234 6.57478 8.15234 6.10618ZM8.15234 9.50011C8.15234 9.03151 8.53222 8.65163 9.00083 8.65163C9.46943 8.65163 9.84931 9.03151 9.84931 9.50011V12.8941C9.84931 13.3627 9.46943 13.7425 9.00083 13.7425C8.53222 13.7425 8.15234 13.3627 8.15234 12.8941V9.50011Z" fill={color ? color : '#575D73'} /> + <circle cx="9" cy="9.5" r="8" stroke={color ? color : '#575D73'} stroke-width="1.5" /> + </svg> + ) +} \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/TokenGatedIcon.svg b/packages/uiweb/src/lib/icons/TokenGatedIcon.svg new file mode 100644 index 000000000..19c599954 --- /dev/null +++ b/packages/uiweb/src/lib/icons/TokenGatedIcon.svg @@ -0,0 +1,3 @@ +<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> +<path d="M9.75 0.25C7.82164 0.25 5.93657 0.821828 4.33319 1.89317C2.72982 2.96452 1.48013 4.48726 0.742179 6.26884C0.00422448 8.05042 -0.188858 10.0108 0.187348 11.9021C0.563554 13.7934 1.49215 15.5307 2.85571 16.8943C4.21927 18.2579 5.95656 19.1865 7.84787 19.5627C9.73919 19.9389 11.6996 19.7458 13.4812 19.0078C15.2627 18.2699 16.7855 17.0202 17.8568 15.4168C18.9282 13.8134 19.5 11.9284 19.5 10C19.4973 7.41498 18.4692 4.93661 16.6413 3.10872C14.8134 1.28084 12.335 0.25273 9.75 0.25ZM15.7613 12.7319C15.9318 12.8343 16.0547 13.0003 16.1029 13.1934C16.1511 13.3864 16.1206 13.5907 16.0181 13.7612C15.9157 13.9318 15.7497 14.0547 15.5566 14.1029C15.3636 14.1511 15.1593 14.1206 14.9888 14.0181L10.5 11.3247V16.1875C10.5 16.3864 10.421 16.5772 10.2803 16.7178C10.1397 16.8585 9.94892 16.9375 9.75 16.9375C9.55109 16.9375 9.36033 16.8585 9.21967 16.7178C9.07902 16.5772 9 16.3864 9 16.1875V11.3247L4.51125 14.0181C4.34069 14.1206 4.13641 14.1511 3.94337 14.1029C3.75032 14.0547 3.58432 13.9318 3.48188 13.7612C3.37944 13.5907 3.34895 13.3864 3.39713 13.1934C3.4453 13.0003 3.56819 12.8343 3.73875 12.7319L8.29219 10L3.73875 7.26813C3.56819 7.16569 3.4453 6.99968 3.39713 6.80664C3.34895 6.61359 3.37944 6.40932 3.48188 6.23875C3.58432 6.06818 3.75032 5.9453 3.94337 5.89712C4.13641 5.84895 4.34069 5.87944 4.51125 5.98187L9 8.67531V3.8125C9 3.61359 9.07902 3.42282 9.21967 3.28217C9.36033 3.14152 9.55109 3.0625 9.75 3.0625C9.94892 3.0625 10.1397 3.14152 10.2803 3.28217C10.421 3.42282 10.5 3.61359 10.5 3.8125V8.67531L14.9888 5.98187C15.0732 5.93115 15.1668 5.89756 15.2643 5.88302C15.3617 5.86848 15.4611 5.87327 15.5566 5.89712C15.6522 5.92098 15.7422 5.96342 15.8214 6.02204C15.9005 6.08065 15.9674 6.15429 16.0181 6.23875C16.0689 6.32321 16.1024 6.41683 16.117 6.51427C16.1315 6.6117 16.1267 6.71105 16.1029 6.80664C16.079 6.90222 16.0366 6.99218 15.978 7.07136C15.9193 7.15054 15.8457 7.2174 15.7613 7.26813L11.2078 10L15.7613 12.7319Z" fill="#657795"/> +</svg> diff --git a/packages/uiweb/src/lib/icons/bsc.svg b/packages/uiweb/src/lib/icons/bsc.svg new file mode 100644 index 000000000..9f841db91 --- /dev/null +++ b/packages/uiweb/src/lib/icons/bsc.svg @@ -0,0 +1,4 @@ + <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <circle cx="12" cy="12" r="12" fill="#1D1D1D"/> + <path d="M8.16193 12L6.58295 13.579L5 12L6.57898 10.421L8.16193 12ZM12 8.16193L14.7085 10.8705L16.2875 9.29148L12 5L7.70852 9.29148L9.2875 10.8705L12 8.16193ZM17.417 10.421L15.8381 12L17.417 13.579L18.996 12L17.417 10.421ZM12 15.8381L9.29148 13.1295L7.7125 14.7085L12 19L16.2875 14.7085L14.7085 13.1295L12 15.8381ZM12 13.579L13.579 12L12 10.421L10.417 12L12 13.579Z" fill="#F0B90B"/> + </svg> \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/ethereum.svg b/packages/uiweb/src/lib/icons/ethereum.svg new file mode 100644 index 000000000..2c9fece8e --- /dev/null +++ b/packages/uiweb/src/lib/icons/ethereum.svg @@ -0,0 +1,9 @@ + <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z" fill="#627EEA"/> + <path d="M12.3735 3V9.6525L17.9963 12.165L12.3735 3Z" fill="white" fill-opacity="0.602"/> + <path d="M12.3735 3L6.75 12.165L12.3735 9.6525V3Z" fill="white"/> + <path d="M12.3735 16.476V20.9963L18 13.212L12.3735 16.476Z" fill="white" fill-opacity="0.602"/> + <path d="M12.3735 20.9963V16.4753L6.75 13.212L12.3735 20.9963Z" fill="white"/> + <path d="M12.3735 15.4298L17.9963 12.1651L12.3735 9.65405V15.4298Z" fill="white" fill-opacity="0.2"/> + <path d="M6.75 12.1651L12.3735 15.4298V9.65405L6.75 12.1651Z" fill="white" fill-opacity="0.602"/> + </svg> \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/optimisim.svg b/packages/uiweb/src/lib/icons/optimisim.svg new file mode 100644 index 000000000..23b8f3969 --- /dev/null +++ b/packages/uiweb/src/lib/icons/optimisim.svg @@ -0,0 +1,12 @@ + <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_9390_20606)"> + <path d="M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z" fill="#FF0420"/> + <path d="M8.50098 15.1872C7.78578 15.1872 7.20018 15.0192 6.74418 14.6832C6.29298 14.3424 6.06738 13.8528 6.06738 13.224C6.06738 13.0896 6.08178 12.9312 6.11058 12.7392C6.18738 12.3072 6.29778 11.7888 6.44178 11.1792C6.84978 9.52799 7.90578 8.70239 9.60498 8.70239C10.0658 8.70239 10.4834 8.77919 10.8482 8.93759C11.213 9.08639 11.501 9.31679 11.7122 9.62399C11.9234 9.92639 12.029 10.2864 12.029 10.704C12.029 10.8288 12.0146 10.9872 11.9858 11.1792C11.8946 11.712 11.789 12.2352 11.6594 12.7392C11.4482 13.56 11.0882 14.1792 10.5698 14.5872C10.0562 14.9904 9.36498 15.1872 8.50098 15.1872ZM8.63058 13.8912C8.96658 13.8912 9.24978 13.7904 9.48498 13.5936C9.72498 13.3968 9.89778 13.0944 9.99858 12.6816C10.1378 12.1152 10.2434 11.6256 10.3154 11.2032C10.3394 11.0784 10.3538 10.9488 10.3538 10.8144C10.3538 10.2672 10.0706 9.99359 9.49938 9.99359C9.16338 9.99359 8.87538 10.0944 8.63538 10.2912C8.40018 10.488 8.23218 10.7904 8.13138 11.2032C8.02098 11.6064 7.91538 12.096 7.80498 12.6816C7.78098 12.8016 7.76658 12.9264 7.76658 13.0608C7.76178 13.6176 8.05458 13.8912 8.63058 13.8912Z" fill="white"/> + <path d="M12.4463 15.1009C12.3791 15.1009 12.3311 15.0817 12.2927 15.0385C12.2639 14.9905 12.2543 14.9377 12.2639 14.8753L13.5071 9.0193C13.5167 8.9521 13.5503 8.8993 13.6079 8.8561C13.6607 8.8129 13.7183 8.7937 13.7807 8.7937H16.1759C16.8431 8.7937 17.3759 8.9329 17.7791 9.2065C18.1871 9.4849 18.3935 9.8833 18.3935 10.4065C18.3935 10.5553 18.3743 10.7137 18.3407 10.8769C18.1919 11.5681 17.8895 12.0769 17.4287 12.4081C16.9775 12.7393 16.3583 12.9025 15.5711 12.9025H14.3567L13.9439 14.8753C13.9295 14.9425 13.9007 14.9953 13.8431 15.0385C13.7903 15.0817 13.7327 15.1009 13.6703 15.1009H12.4463ZM15.6335 11.6593C15.8879 11.6593 16.1039 11.5921 16.2911 11.4529C16.4831 11.3137 16.6079 11.1169 16.6703 10.8577C16.6895 10.7569 16.6991 10.6657 16.6991 10.5889C16.6991 10.4161 16.6463 10.2817 16.5455 10.1905C16.4447 10.0945 16.2671 10.0465 16.0223 10.0465H14.9423L14.6015 11.6593H15.6335Z" fill="white"/> + </g> + <defs> + <clipPath id="clip0_9390_20606"> + <rect width="24" height="24" fill="white"/> + </clipPath> + </defs> + </svg> \ No newline at end of file diff --git a/packages/uiweb/src/lib/icons/polygon.svg b/packages/uiweb/src/lib/icons/polygon.svg new file mode 100644 index 000000000..20101fd5a --- /dev/null +++ b/packages/uiweb/src/lib/icons/polygon.svg @@ -0,0 +1,13 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_5284_6348)"> + <path d="M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z" fill="#7B3FE4"/> + <path d="M20 12.2801V15.9003C19.9987 16.1261 19.9391 16.3476 19.8269 16.5433C19.7147 16.739 19.5538 16.9021 19.36 17.0168L16.235 18.8231C16.0415 18.9389 15.8203 19 15.595 19C15.3697 19 15.1485 18.9389 14.955 18.8231L11.83 17.0168C11.6362 16.9021 11.4753 16.739 11.3631 16.5433C11.251 16.3476 11.1913 16.1261 11.19 15.9003V14.8842L12.79 13.9522V15.7184L15.59 17.3492L18.39 15.7184V12.4645L15.59 10.8337L9.03001 14.6472C8.83465 14.7576 8.61421 14.8157 8.38999 14.8157C8.16577 14.8157 7.94536 14.7576 7.75 14.6472L4.62499 12.8333C4.43416 12.7169 4.27639 12.5532 4.16692 12.3579C4.05745 12.1625 3.99997 11.9422 4 11.7181V8.09786C4.00129 7.87211 4.06096 7.65056 4.17313 7.45487C4.28533 7.25918 4.44619 7.09604 4.63999 6.98144L7.765 5.17508C7.95895 5.06045 8.17993 5 8.40499 5C8.63008 5 8.85106 5.06045 9.04501 5.17508L12.17 6.98144C12.3638 7.09604 12.5247 7.25918 12.6369 7.45487C12.7491 7.65056 12.8087 7.87211 12.81 8.09786V9.11393L11.2 10.0397V8.28353L8.40001 6.65279L5.59999 8.28353V11.5337L8.40001 13.1644L14.96 9.35102C15.1553 9.24056 15.3758 9.18254 15.6 9.18254C15.8242 9.18254 16.0446 9.24056 16.24 9.35102L19.365 11.1649C19.5577 11.28 19.7175 11.4433 19.8287 11.6386C19.94 11.8341 19.999 12.055 20 12.2801Z" fill="white"/> + </g> + <defs> + <clipPath id="clip0_5284_6348"> + <rect width="24" height="24" fill="white"/> + </clipPath> + </defs> + </svg> + + \ No newline at end of file diff --git a/packages/uiweb/src/lib/services/getLivekitRoomToken.ts b/packages/uiweb/src/lib/services/getLivekitRoomToken.ts new file mode 100644 index 000000000..0b8c769c1 --- /dev/null +++ b/packages/uiweb/src/lib/services/getLivekitRoomToken.ts @@ -0,0 +1,25 @@ +import axios from "axios" +import { v4 as uuidv4 } from "uuid"; + +import { LIVEKIT_TOKEN_GENERATOR_SERVER_URL } from "../config"; + +export interface IGetLivekitRoomProps { + userType: "sender" | "receiver"; + roomId: string; + userId?: string; +} + +export const getLivekitRoomToken = async ({ userType, roomId, userId }: IGetLivekitRoomProps) => { + console.log("🚀 ~ file: getToken.js:5 ~ getToken ~ roomId:", roomId) + console.log("🚀 ~ file: getToken.js:5 ~ getToken ~ userId:", userId) + if (userType !== "sender" && userType !== "receiver") { + throw new Error("Invalid userType. Use 'sender' or 'receiver'."); + } + + // generate a unique uuid + const identity = uuidv4(); + + const url = `${LIVEKIT_TOKEN_GENERATOR_SERVER_URL}/token?userType=${userType}&userName=${userId || identity}&roomId=${roomId}`; + + return await axios.get(url); +}; \ No newline at end of file diff --git a/packages/uiweb/src/lib/services/index.ts b/packages/uiweb/src/lib/services/index.ts new file mode 100644 index 000000000..783766645 --- /dev/null +++ b/packages/uiweb/src/lib/services/index.ts @@ -0,0 +1,2 @@ +export { getLivekitRoomToken } from "./getLivekitRoomToken"; +export { performAction } from "./performAction"; diff --git a/packages/uiweb/src/lib/services/performAction.ts b/packages/uiweb/src/lib/services/performAction.ts new file mode 100644 index 000000000..96239adf0 --- /dev/null +++ b/packages/uiweb/src/lib/services/performAction.ts @@ -0,0 +1,15 @@ +import axios from "axios" + +import { LIVEKIT_TOKEN_GENERATOR_SERVER_URL } from "../config"; + +export interface IPerformActionProps { + canPublish: boolean; + roomId: string | undefined; + userId?: string; +} + +export const performAction = async ({ roomId, userId, canPublish }: IPerformActionProps) => { + const url = `${LIVEKIT_TOKEN_GENERATOR_SERVER_URL}/execute?roomName=${roomId}&identity=${userId}&canPublish=${canPublish}`; + + return await axios.get(url); +}; \ No newline at end of file diff --git a/packages/uiweb/src/lib/types/index.ts b/packages/uiweb/src/lib/types/index.ts index 4efb3e5ed..8337566b4 100644 --- a/packages/uiweb/src/lib/types/index.ts +++ b/packages/uiweb/src/lib/types/index.ts @@ -1,6 +1,6 @@ import type { ReactElement } from 'react'; import type { ENV } from '../config'; -import type { ParsedResponseType, IFeeds, } from '@pushprotocol/restapi'; +import type { ParsedResponseType, IFeeds, Rules, } from '@pushprotocol/restapi'; import { Bytes, TypedDataDomain, TypedDataField, providers } from 'ethers'; export interface IMessageIPFS { @@ -134,6 +134,6 @@ export interface IGroup { groupDescription: string | null, groupCreator: string, chatId: string, - groupType?:string | undefined + groupType?:string | undefined, + rules?: Rules | null, } - diff --git a/packages/uiweb/yarn.lock b/packages/uiweb/yarn.lock index 13ac1d4f6..fe58dcd8b 100644 --- a/packages/uiweb/yarn.lock +++ b/packages/uiweb/yarn.lock @@ -9,7 +9,167 @@ dependencies: regenerator-runtime "^0.13.11" -"@ethersproject/abi@^5.0.1": +"@bufbuild/protobuf@^1.3.0": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.3.1.tgz#c4de66bacbe7ac97fe054e68314aeba6f45177f9" + integrity sha512-BUyJWutgP2S8K/1NphOJokuwDckXS4qI2T1pGZAlkFdZchWae3jm6fCdkcGbLlM1QLOcNFFePd+7Feo4BYGrJQ== + +"@babel/runtime@^7.17.2", "@babel/runtime@^7.22.6": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.15.tgz#38f46494ccf6cf020bd4eed7124b425e83e523b8" + integrity sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA== + dependencies: + regenerator-runtime "^0.14.0" + +"@coinbase/wallet-sdk@^3.7.1": + version "3.7.2" + resolved "https://registry.yarnpkg.com/@coinbase/wallet-sdk/-/wallet-sdk-3.7.2.tgz#7a89bd9e3a06a1f26d4480d8642af33fb0c7e3aa" + integrity sha512-lIGvXMsgpsQWci/XOMQIJ2nIZ8JUy/L+bvC0wkRaYarr0YylwpXrJ2gRM3hCXPS477pkyO7N/kSiAoRgEXUdJQ== + dependencies: + "@metamask/safe-event-emitter" "2.0.0" + "@solana/web3.js" "^1.70.1" + bind-decorator "^1.0.11" + bn.js "^5.1.1" + buffer "^6.0.3" + clsx "^1.1.0" + eth-block-tracker "6.1.0" + eth-json-rpc-filters "5.1.0" + eth-rpc-errors "4.0.2" + json-rpc-engine "6.1.0" + keccak "^3.0.1" + preact "^10.5.9" + qs "^6.10.3" + rxjs "^6.6.3" + sha.js "^2.4.11" + stream-browserify "^3.0.0" + util "^0.12.4" + +"@esbuild/android-arm64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz#bc35990f412a749e948b792825eef7df0ce0e073" + integrity sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw== + +"@esbuild/android-arm@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.2.tgz#edd1c8f23ba353c197f5b0337123c58ff2a56999" + integrity sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q== + +"@esbuild/android-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.2.tgz#2dcdd6e6f1f2d82ea1b746abd8da5b284960f35a" + integrity sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w== + +"@esbuild/darwin-arm64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz#55b36bc06d76f5c243987c1f93a11a80d8fc3b26" + integrity sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA== + +"@esbuild/darwin-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz#982524af33a6424a3b5cb44bbd52559623ad719c" + integrity sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw== + +"@esbuild/freebsd-arm64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz#8e478a0856645265fe79eac4b31b52193011ee06" + integrity sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ== + +"@esbuild/freebsd-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz#01b96604f2540db023c73809bb8ae6cd1692d6f3" + integrity sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw== + +"@esbuild/linux-arm64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz#7e5d2c7864c5c83ec789b59c77cd9c20d2594916" + integrity sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg== + +"@esbuild/linux-arm@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz#c32ae97bc0246664a1cfbdb4a98e7b006d7db8ae" + integrity sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg== + +"@esbuild/linux-ia32@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz#3fc4f0fa026057fe885e4a180b3956e704f1ceaa" + integrity sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ== + +"@esbuild/linux-loong64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz#633bcaea443f3505fb0ed109ab840c99ad3451a4" + integrity sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw== + +"@esbuild/linux-mips64el@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz#e0bff2898c46f52be7d4dbbcca8b887890805823" + integrity sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg== + +"@esbuild/linux-ppc64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz#d75798da391f54a9674f8c143b9a52d1dbfbfdde" + integrity sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw== + +"@esbuild/linux-riscv64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz#012409bd489ed1bb9b775541d4a46c5ded8e6dd8" + integrity sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw== + +"@esbuild/linux-s390x@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz#ece3ed75c5a150de8a5c110f02e97d315761626b" + integrity sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g== + +"@esbuild/linux-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz#dea187019741602d57aaf189a80abba261fbd2aa" + integrity sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ== + +"@esbuild/netbsd-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz#bbfd7cf9ab236a23ee3a41b26f0628c57623d92a" + integrity sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ== + +"@esbuild/openbsd-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz#fa5c4c6ee52a360618f00053652e2902e1d7b4a7" + integrity sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw== + +"@esbuild/sunos-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz#52a2ac8ac6284c02d25df22bb4cfde26fbddd68d" + integrity sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw== + +"@esbuild/win32-arm64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz#719ed5870855de8537aef8149694a97d03486804" + integrity sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg== + +"@esbuild/win32-ia32@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz#24832223880b0f581962c8660f8fb8797a1e046a" + integrity sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA== + +"@esbuild/win32-x64@0.19.2": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz#1205014625790c7ff0e471644a878a65d1e34ab0" + integrity sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw== + +"@ethersproject/abi@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.5.0.tgz#fb52820e22e50b854ff15ce1647cc508d6660613" + integrity sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w== + dependencies: + "@ethersproject/address" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/hash" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + +"@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.0.1", "@ethersproject/abi@^5.5.0", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz" integrity sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA== @@ -24,7 +184,20 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@ethersproject/abstract-provider@^5.7.0": +"@ethersproject/abstract-provider@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz#2f1f6e8a3ab7d378d8ad0b5718460f85649710c5" + integrity sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg== + dependencies: + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/networks" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + "@ethersproject/web" "^5.5.0" + +"@ethersproject/abstract-provider@5.7.0", "@ethersproject/abstract-provider@^5.5.0", "@ethersproject/abstract-provider@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz" integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== @@ -37,7 +210,18 @@ "@ethersproject/transactions" "^5.7.0" "@ethersproject/web" "^5.7.0" -"@ethersproject/abstract-signer@^5.7.0": +"@ethersproject/abstract-signer@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz#590ff6693370c60ae376bf1c7ada59eb2a8dd08d" + integrity sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA== + dependencies: + "@ethersproject/abstract-provider" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + +"@ethersproject/abstract-signer@5.7.0", "@ethersproject/abstract-signer@^5.5.0", "@ethersproject/abstract-signer@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz" integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== @@ -48,7 +232,18 @@ "@ethersproject/logger" "^5.7.0" "@ethersproject/properties" "^5.7.0" -"@ethersproject/address@^5.7.0": +"@ethersproject/address@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.5.0.tgz#bcc6f576a553f21f3dd7ba17248f81b473c9c78f" + integrity sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw== + dependencies: + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/rlp" "^5.5.0" + +"@ethersproject/address@5.7.0", "@ethersproject/address@^5.5.0", "@ethersproject/address@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz" integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== @@ -59,14 +254,46 @@ "@ethersproject/logger" "^5.7.0" "@ethersproject/rlp" "^5.7.0" -"@ethersproject/base64@^5.7.0": +"@ethersproject/base64@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.5.0.tgz#881e8544e47ed976930836986e5eb8fab259c090" + integrity sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA== + dependencies: + "@ethersproject/bytes" "^5.5.0" + +"@ethersproject/base64@5.7.0", "@ethersproject/base64@^5.5.0", "@ethersproject/base64@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz" integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== dependencies: "@ethersproject/bytes" "^5.7.0" -"@ethersproject/bignumber@^5.7.0": +"@ethersproject/basex@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.5.0.tgz#e40a53ae6d6b09ab4d977bd037010d4bed21b4d3" + integrity sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + +"@ethersproject/basex@5.7.0", "@ethersproject/basex@^5.5.0", "@ethersproject/basex@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.7.0.tgz#97034dc7e8938a8ca943ab20f8a5e492ece4020b" + integrity sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + +"@ethersproject/bignumber@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.5.0.tgz#875b143f04a216f4f8b96245bde942d42d279527" + integrity sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + bn.js "^4.11.9" + +"@ethersproject/bignumber@5.7.0", "@ethersproject/bignumber@^5.5.0", "@ethersproject/bignumber@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz" integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== @@ -75,21 +302,81 @@ "@ethersproject/logger" "^5.7.0" bn.js "^5.2.1" -"@ethersproject/bytes@^5.7.0": +"@ethersproject/bytes@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.5.0.tgz#cb11c526de657e7b45d2e0f0246fb3b9d29a601c" + integrity sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog== + dependencies: + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/bytes@5.7.0", "@ethersproject/bytes@^5.5.0", "@ethersproject/bytes@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz" integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/constants@^5.7.0": +"@ethersproject/constants@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.5.0.tgz#d2a2cd7d94bd1d58377d1d66c4f53c9be4d0a45e" + integrity sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ== + dependencies: + "@ethersproject/bignumber" "^5.5.0" + +"@ethersproject/constants@5.7.0", "@ethersproject/constants@^5.5.0", "@ethersproject/constants@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz" integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== dependencies: "@ethersproject/bignumber" "^5.7.0" -"@ethersproject/hash@^5.7.0": +"@ethersproject/contracts@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.5.0.tgz#b735260d4bd61283a670a82d5275e2a38892c197" + integrity sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg== + dependencies: + "@ethersproject/abi" "^5.5.0" + "@ethersproject/abstract-provider" "^5.5.0" + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + +"@ethersproject/contracts@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" + integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + +"@ethersproject/hash@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.5.0.tgz#7cee76d08f88d1873574c849e0207dcb32380cc9" + integrity sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg== + dependencies: + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + +"@ethersproject/hash@5.7.0", "@ethersproject/hash@^5.5.0", "@ethersproject/hash@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz" integrity sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g== @@ -104,7 +391,89 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" -"@ethersproject/keccak256@^5.7.0": +"@ethersproject/hdnode@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.5.0.tgz#4a04e28f41c546f7c978528ea1575206a200ddf6" + integrity sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q== + dependencies: + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/basex" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/pbkdf2" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/sha2" "^5.5.0" + "@ethersproject/signing-key" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + "@ethersproject/wordlists" "^5.5.0" + +"@ethersproject/hdnode@5.7.0", "@ethersproject/hdnode@^5.5.0", "@ethersproject/hdnode@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.7.0.tgz#e627ddc6b466bc77aebf1a6b9e47405ca5aef9cf" + integrity sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/json-wallets@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz#dd522d4297e15bccc8e1427d247ec8376b60e325" + integrity sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ== + dependencies: + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/hdnode" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/pbkdf2" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/random" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/json-wallets@5.7.0", "@ethersproject/json-wallets@^5.5.0", "@ethersproject/json-wallets@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz#5e3355287b548c32b368d91014919ebebddd5360" + integrity sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g== + dependencies: + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/pbkdf2" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + aes-js "3.0.0" + scrypt-js "3.0.1" + +"@ethersproject/keccak256@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.5.0.tgz#e4b1f9d7701da87c564ffe336f86dcee82983492" + integrity sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg== + dependencies: + "@ethersproject/bytes" "^5.5.0" + js-sha3 "0.8.0" + +"@ethersproject/keccak256@5.7.0", "@ethersproject/keccak256@^5.5.0", "@ethersproject/keccak256@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz" integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== @@ -112,26 +481,186 @@ "@ethersproject/bytes" "^5.7.0" js-sha3 "0.8.0" -"@ethersproject/logger@^5.7.0": +"@ethersproject/logger@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.5.0.tgz#0c2caebeff98e10aefa5aef27d7441c7fd18cf5d" + integrity sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg== + +"@ethersproject/logger@5.7.0", "@ethersproject/logger@^5.5.0", "@ethersproject/logger@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz" integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== -"@ethersproject/networks@^5.7.0": +"@ethersproject/networks@5.5.2": + version "5.5.2" + resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.5.2.tgz#784c8b1283cd2a931114ab428dae1bd00c07630b" + integrity sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ== + dependencies: + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/networks@5.7.1", "@ethersproject/networks@^5.5.0", "@ethersproject/networks@^5.7.0": version "5.7.1" resolved "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz" integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/properties@^5.7.0": +"@ethersproject/pbkdf2@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz#e25032cdf02f31505d47afbf9c3e000d95c4a050" + integrity sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/sha2" "^5.5.0" + +"@ethersproject/pbkdf2@5.7.0", "@ethersproject/pbkdf2@^5.5.0", "@ethersproject/pbkdf2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz#d2267d0a1f6e123f3771007338c47cccd83d3102" + integrity sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + +"@ethersproject/properties@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.5.0.tgz#61f00f2bb83376d2071baab02245f92070c59995" + integrity sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA== + dependencies: + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/properties@5.7.0", "@ethersproject/properties@^5.5.0", "@ethersproject/properties@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz" integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/rlp@^5.7.0": +"@ethersproject/providers@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.0.tgz#bc2876a8fe5e0053ed9828b1f3767ae46e43758b" + integrity sha512-xqMbDnS/FPy+J/9mBLKddzyLLAQFjrVff5g00efqxPzcAwXiR+SiCGVy6eJ5iAIirBOATjx7QLhDNPGV+AEQsw== + dependencies: + "@ethersproject/abstract-provider" "^5.5.0" + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/basex" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/hash" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/networks" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/random" "^5.5.0" + "@ethersproject/rlp" "^5.5.0" + "@ethersproject/sha2" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + "@ethersproject/web" "^5.5.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/providers@5.5.2": + version "5.5.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.2.tgz#131ccf52dc17afd0ab69ed444b8c0e3a27297d99" + integrity sha512-hkbx7x/MKcRjyrO4StKXCzCpWer6s97xnm34xkfPiarhtEUVAN4TBBpamM+z66WcTt7H5B53YwbRj1n7i8pZoQ== + dependencies: + "@ethersproject/abstract-provider" "^5.5.0" + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/basex" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/hash" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/networks" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/random" "^5.5.0" + "@ethersproject/rlp" "^5.5.0" + "@ethersproject/sha2" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + "@ethersproject/web" "^5.5.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/providers@5.5.3": + version "5.5.3" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.3.tgz#56c2b070542ac44eb5de2ed3cf6784acd60a3130" + integrity sha512-ZHXxXXXWHuwCQKrgdpIkbzMNJMvs+9YWemanwp1fA7XZEv7QlilseysPvQe0D7Q7DlkJX/w/bGA1MdgK2TbGvA== + dependencies: + "@ethersproject/abstract-provider" "^5.5.0" + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/basex" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/hash" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/networks" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/random" "^5.5.0" + "@ethersproject/rlp" "^5.5.0" + "@ethersproject/sha2" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + "@ethersproject/web" "^5.5.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/providers@5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/base64" "^5.7.0" + "@ethersproject/basex" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/networks" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/rlp" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/web" "^5.7.0" + bech32 "1.1.4" + ws "7.4.6" + +"@ethersproject/random@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.5.1.tgz#7cdf38ea93dc0b1ed1d8e480ccdaf3535c555415" + integrity sha512-YaU2dQ7DuhL5Au7KbcQLHxcRHfgyNgvFV4sQOo0HrtW3Zkrc9ctWNz8wXQ4uCSfSDsqX2vcjhroxU5RQRV0nqA== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/random@5.7.0", "@ethersproject/random@^5.5.0", "@ethersproject/random@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.7.0.tgz#af19dcbc2484aae078bb03656ec05df66253280c" + integrity sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/rlp@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.5.0.tgz#530f4f608f9ca9d4f89c24ab95db58ab56ab99a0" + integrity sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/rlp@5.7.0", "@ethersproject/rlp@^5.5.0", "@ethersproject/rlp@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz" integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== @@ -139,7 +668,37 @@ "@ethersproject/bytes" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/signing-key@^5.7.0": +"@ethersproject/sha2@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.5.0.tgz#a40a054c61f98fd9eee99af2c3cc6ff57ec24db7" + integrity sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + hash.js "1.1.7" + +"@ethersproject/sha2@5.7.0", "@ethersproject/sha2@^5.5.0", "@ethersproject/sha2@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.7.0.tgz#9a5f7a7824ef784f7f7680984e593a800480c9fb" + integrity sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.5.0.tgz#2aa37169ce7e01e3e80f2c14325f624c29cedbe0" + integrity sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + bn.js "^4.11.9" + elliptic "6.5.4" + hash.js "1.1.7" + +"@ethersproject/signing-key@5.7.0", "@ethersproject/signing-key@^5.5.0", "@ethersproject/signing-key@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz" integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== @@ -151,7 +710,40 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/strings@^5.7.0": +"@ethersproject/solidity@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.5.0.tgz#2662eb3e5da471b85a20531e420054278362f93f" + integrity sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw== + dependencies: + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/sha2" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + +"@ethersproject/solidity@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" + integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/sha2" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + +"@ethersproject/strings@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.5.0.tgz#e6784d00ec6c57710755699003bc747e98c5d549" + integrity sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/strings@5.7.0", "@ethersproject/strings@^5.5.0", "@ethersproject/strings@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz" integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== @@ -160,7 +752,22 @@ "@ethersproject/constants" "^5.7.0" "@ethersproject/logger" "^5.7.0" -"@ethersproject/transactions@^5.7.0": +"@ethersproject/transactions@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.5.0.tgz#7e9bf72e97bcdf69db34fe0d59e2f4203c7a2908" + integrity sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA== + dependencies: + "@ethersproject/address" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/rlp" "^5.5.0" + "@ethersproject/signing-key" "^5.5.0" + +"@ethersproject/transactions@5.7.0", "@ethersproject/transactions@^5.5.0", "@ethersproject/transactions@^5.7.0": version "5.7.0" resolved "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz" integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== @@ -175,7 +782,78 @@ "@ethersproject/rlp" "^5.7.0" "@ethersproject/signing-key" "^5.7.0" -"@ethersproject/web@^5.7.0": +"@ethersproject/units@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.5.0.tgz#104d02db5b5dc42cc672cc4587bafb87a95ee45e" + integrity sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag== + dependencies: + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/constants" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + +"@ethersproject/units@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.7.0.tgz#637b563d7e14f42deeee39245275d477aae1d8b1" + integrity sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg== + dependencies: + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + +"@ethersproject/wallet@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.5.0.tgz#322a10527a440ece593980dca6182f17d54eae75" + integrity sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q== + dependencies: + "@ethersproject/abstract-provider" "^5.5.0" + "@ethersproject/abstract-signer" "^5.5.0" + "@ethersproject/address" "^5.5.0" + "@ethersproject/bignumber" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/hash" "^5.5.0" + "@ethersproject/hdnode" "^5.5.0" + "@ethersproject/json-wallets" "^5.5.0" + "@ethersproject/keccak256" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/random" "^5.5.0" + "@ethersproject/signing-key" "^5.5.0" + "@ethersproject/transactions" "^5.5.0" + "@ethersproject/wordlists" "^5.5.0" + +"@ethersproject/wallet@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" + integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== + dependencies: + "@ethersproject/abstract-provider" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/hdnode" "^5.7.0" + "@ethersproject/json-wallets" "^5.7.0" + "@ethersproject/keccak256" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/random" "^5.7.0" + "@ethersproject/signing-key" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wordlists" "^5.7.0" + +"@ethersproject/web@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.5.1.tgz#cfcc4a074a6936c657878ac58917a61341681316" + integrity sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg== + dependencies: + "@ethersproject/base64" "^5.5.0" + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + +"@ethersproject/web@5.7.1", "@ethersproject/web@^5.5.0", "@ethersproject/web@^5.7.0": version "5.7.1" resolved "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz" integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== @@ -186,6 +864,28 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" +"@ethersproject/wordlists@5.5.0": + version "5.5.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.5.0.tgz#aac74963aa43e643638e5172353d931b347d584f" + integrity sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q== + dependencies: + "@ethersproject/bytes" "^5.5.0" + "@ethersproject/hash" "^5.5.0" + "@ethersproject/logger" "^5.5.0" + "@ethersproject/properties" "^5.5.0" + "@ethersproject/strings" "^5.5.0" + +"@ethersproject/wordlists@5.7.0", "@ethersproject/wordlists@^5.5.0", "@ethersproject/wordlists@^5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.7.0.tgz#8fb2c07185d68c3e09eb3bfd6e779ba2774627f5" + integrity sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA== + dependencies: + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/hash" "^5.7.0" + "@ethersproject/logger" "^5.7.0" + "@ethersproject/properties" "^5.7.0" + "@ethersproject/strings" "^5.7.0" + "@floating-ui/core@^1.4.1": version "1.4.1" resolved "https://registry.npmjs.org/@floating-ui/core/-/core-1.4.1.tgz" @@ -193,6 +893,21 @@ dependencies: "@floating-ui/utils" "^0.1.1" +"@floating-ui/core@^1.4.2": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.5.0.tgz#5c05c60d5ae2d05101c3021c1a2a350ddc027f8c" + integrity sha512-kK1h4m36DQ0UHGj5Ah4db7R0rHemTqqO0QLvUqi1/mUUp3LuAWbWxdxSIf/XsnH9VS6rRVPLJCncjRzUvyCLXg== + dependencies: + "@floating-ui/utils" "^0.1.3" + +"@floating-ui/dom@^1.1.0": + version "1.5.3" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.5.3.tgz#54e50efcb432c06c23cd33de2b575102005436fa" + integrity sha512-ClAbQnEqJAKCJOEbbLo5IUlZHkNszqhuxS4fHAVxRPXPya6Ysf2G8KypnYcOTpx6I8xcgF9bbHb6g/2KpbV8qA== + dependencies: + "@floating-ui/core" "^1.4.2" + "@floating-ui/utils" "^0.1.3" + "@floating-ui/dom@^1.3.0": version "1.5.1" resolved "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.1.tgz" @@ -213,6 +928,100 @@ resolved "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz" integrity sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw== +"@floating-ui/utils@^0.1.3": + version "0.1.4" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.1.4.tgz#19654d1026cc410975d46445180e70a5089b3e7d" + integrity sha512-qprfWkn82Iw821mcKofJ5Pk9wgioHicxcQMxx+5zt5GSKoqdWvgG5AxVmpmUUjzTLPVSH5auBrhI93Deayn/DA== + +"@livekit/components-core@0.7.0": + version "0.7.0" + resolved "https://registry.yarnpkg.com/@livekit/components-core/-/components-core-0.7.0.tgz#1283a34753c8f1bb805b987684a3e29d1bc2eb39" + integrity sha512-KwzqnW8V9G+4fXc4gOxpXqQFLpL/kFBn82sYO10zHjHfNKSw4pRj1sDLTWc5UF22W2Z461/bqMtB+3WGB/3Dtg== + dependencies: + "@floating-ui/dom" "^1.1.0" + email-regex "^5.0.0" + global-tld-list "^0.0.1139" + loglevel "^1.8.1" + rxjs "^7.8.0" + +"@livekit/components-react@^1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@livekit/components-react/-/components-react-1.2.2.tgz#202083f70d5fb5512077fd145e81232116601e0a" + integrity sha512-0ds0A/XUUG9zarAZdlUdOEJsKKVp7kwFS+wFBXgJ2KcQwNJVCZh+NY780QP4r9E8R+knRJy/kkmEGYcCxvrgWA== + dependencies: + "@livekit/components-core" "0.7.0" + "@react-hook/latest" "^1.0.3" + clsx "^2.0.0" + usehooks-ts "^2.9.1" + +"@livekit/components-styles@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@livekit/components-styles/-/components-styles-1.0.6.tgz#2649c61a631efff37eb2326e100e34a84e597d71" + integrity sha512-/toY2NFJCU0NdeP9AB+CWW9kPf8gdpndIoR0hYTKjDb8pHPdXDu5NE7XyO8qKIeV4biRFGsQ9+C3giPNgYm9TA== + +"@formatjs/ecma402-abstract@1.11.4": + version "1.11.4" + resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.11.4.tgz#b962dfc4ae84361f9f08fbce411b4e4340930eda" + integrity sha512-EBikYFp2JCdIfGEb5G9dyCkTGDmC57KSHhRQOC3aYxoPWVZvfWCDjZwkGYHN7Lis/fmuWl906bnNTJifDQ3sXw== + dependencies: + "@formatjs/intl-localematcher" "0.2.25" + tslib "^2.1.0" + +"@formatjs/fast-memoize@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@formatjs/fast-memoize/-/fast-memoize-1.2.1.tgz#e6f5aee2e4fd0ca5edba6eba7668e2d855e0fc21" + integrity sha512-Rg0e76nomkz3vF9IPlKeV+Qynok0r7YZjL6syLz4/urSg0IbjPZCB/iYUMNsYA643gh4mgrX3T7KEIFIxJBQeg== + dependencies: + tslib "^2.1.0" + +"@formatjs/icu-messageformat-parser@2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.1.0.tgz#a54293dd7f098d6a6f6a084ab08b6d54a3e8c12d" + integrity sha512-Qxv/lmCN6hKpBSss2uQ8IROVnta2r9jd3ymUEIjm2UyIkUCHVcbUVRGL/KS/wv7876edvsPe+hjHVJ4z8YuVaw== + dependencies: + "@formatjs/ecma402-abstract" "1.11.4" + "@formatjs/icu-skeleton-parser" "1.3.6" + tslib "^2.1.0" + +"@formatjs/icu-skeleton-parser@1.3.6": + version "1.3.6" + resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.3.6.tgz#4ce8c0737d6f07b735288177049e97acbf2e8964" + integrity sha512-I96mOxvml/YLrwU2Txnd4klA7V8fRhb6JG/4hm3VMNmeJo1F03IpV2L3wWt7EweqNLES59SZ4d6hVOPCSf80Bg== + dependencies: + "@formatjs/ecma402-abstract" "1.11.4" + tslib "^2.1.0" + +"@formatjs/intl-localematcher@0.2.25": + version "0.2.25" + resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.2.25.tgz#60892fe1b271ec35ba07a2eb018a2dd7bca6ea3a" + integrity sha512-YmLcX70BxoSopLFdLr1Ds99NdlTI2oWoLbaUW2M406lxOIPzE1KQhRz2fPUkq34xVZQaihCoU29h0KK7An3bhA== + dependencies: + tslib "^2.1.0" + +"@hapi/hoek@^9.0.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" + integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== + +"@hapi/topo@^5.0.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" + integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz#64df34e2f12e68e78ac57e571d25ec07fa460ca9" + integrity sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ== + +"@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.6.0": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.6.3.tgz#25b4eece2592132845d303e091bad9b04cdcfe03" + integrity sha512-QuTgnG52Poic7uM1AN5yJ09QMe0O28e10XzSvWDz02TJiiKee4stsiownEIadWm8nYzyDAyT+gKzUoZmiWQtsQ== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.0.0" + "@livepeer/core-react@^1.8.0": version "1.8.0" resolved "https://registry.npmjs.org/@livepeer/core-react/-/core-react-1.8.0.tgz" @@ -251,6 +1060,102 @@ livepeer "2.8.0" zustand "^4.3.9" +"@metamask/safe-event-emitter@2.0.0", "@metamask/safe-event-emitter@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@metamask/safe-event-emitter/-/safe-event-emitter-2.0.0.tgz#af577b477c683fad17c619a78208cede06f9605c" + integrity sha512-/kSXhY692qiV1MXu6EeOZvg5nECLclxNXcKCxJ3cXQgYuRymRHpdx/t7JXfsK+JLjwA1e1c1/SBrlQYpusC29Q== + +"@metamask/utils@^3.0.1": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@metamask/utils/-/utils-3.6.0.tgz#b218b969a05ca7a8093b5d1670f6625061de707d" + integrity sha512-9cIRrfkWvHblSiNDVXsjivqa9Ak0RYo/1H6tqTqTbAx+oBK2Sva0lWDHxGchOqA7bySGUJKAWSNJvH6gdHZ0gQ== + dependencies: + "@types/debug" "^4.1.7" + debug "^4.3.4" + semver "^7.3.8" + superstruct "^1.0.3" + +"@motionone/animation@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/animation/-/animation-10.15.1.tgz#4a85596c31cbc5100ae8eb8b34c459fb0ccf6807" + integrity sha512-mZcJxLjHor+bhcPuIFErMDNyrdb2vJur8lSfMCsuCB4UyV8ILZLvK+t+pg56erv8ud9xQGK/1OGPt10agPrCyQ== + dependencies: + "@motionone/easing" "^10.15.1" + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + tslib "^2.3.1" + +"@motionone/dom@^10.16.2": + version "10.16.2" + resolved "https://registry.yarnpkg.com/@motionone/dom/-/dom-10.16.2.tgz#0c44df8ee3d1cfc50ee11d27050b27824355a61a" + integrity sha512-bnuHdNbge1FutZXv+k7xub9oPWcF0hsu8y1HTH/qg6av58YI0VufZ3ngfC7p2xhMJMnoh0LXFma2EGTgPeCkeg== + dependencies: + "@motionone/animation" "^10.15.1" + "@motionone/generators" "^10.15.1" + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + hey-listen "^1.0.8" + tslib "^2.3.1" + +"@motionone/easing@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/easing/-/easing-10.15.1.tgz#95cf3adaef34da6deebb83940d8143ede3deb693" + integrity sha512-6hIHBSV+ZVehf9dcKZLT7p5PEKHGhDwky2k8RKkmOvUoYP3S+dXsKupyZpqx5apjd9f+php4vXk4LuS+ADsrWw== + dependencies: + "@motionone/utils" "^10.15.1" + tslib "^2.3.1" + +"@motionone/generators@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/generators/-/generators-10.15.1.tgz#dc6abb11139d1bafe758a41c134d4c753a9b871c" + integrity sha512-67HLsvHJbw6cIbLA/o+gsm7h+6D4Sn7AUrB/GPxvujse1cGZ38F5H7DzoH7PhX+sjvtDnt2IhFYF2Zp1QTMKWQ== + dependencies: + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + tslib "^2.3.1" + +"@motionone/svelte@^10.16.2": + version "10.16.2" + resolved "https://registry.yarnpkg.com/@motionone/svelte/-/svelte-10.16.2.tgz#0b37c3b12927814d31d24941d1ca0ff49981b444" + integrity sha512-38xsroKrfK+aHYhuQlE6eFcGy0EwrB43Q7RGjF73j/kRUTcLNu/LAaKiLLsN5lyqVzCgTBVt4TMT/ShWbTbc5Q== + dependencies: + "@motionone/dom" "^10.16.2" + tslib "^2.3.1" + +"@motionone/types@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/types/-/types-10.15.1.tgz#89441b54285012795cbba8612cbaa0fa420db3eb" + integrity sha512-iIUd/EgUsRZGrvW0jqdst8st7zKTzS9EsKkP+6c6n4MPZoQHwiHuVtTQLD6Kp0bsBLhNzKIBlHXponn/SDT4hA== + +"@motionone/utils@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/utils/-/utils-10.15.1.tgz#6b5f51bde75be88b5411e084310299050368a438" + integrity sha512-p0YncgU+iklvYr/Dq4NobTRdAPv9PveRDUXabPEeOjBLSO/1FNB2phNTZxOxpi1/GZwYpAoECEa0Wam+nsmhSw== + dependencies: + "@motionone/types" "^10.15.1" + hey-listen "^1.0.8" + tslib "^2.3.1" + +"@motionone/vue@^10.16.2": + version "10.16.2" + resolved "https://registry.yarnpkg.com/@motionone/vue/-/vue-10.16.2.tgz#faf13afc27620a2df870c71c58a04ee8de8dea65" + integrity sha512-7/dEK/nWQXOkJ70bqb2KyNfSWbNvWqKKq1C8juj+0Mg/AorgD8O5wE3naddK0G+aXuNMqRuc4jlsYHHWHtIzVw== + dependencies: + "@motionone/dom" "^10.16.2" + tslib "^2.3.1" + +"@noble/curves@^1.0.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@1.3.2", "@noble/hashes@^1.3.1": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@pushprotocol/socket@^0.5.0": version "0.5.0" resolved "https://registry.npmjs.org/@pushprotocol/socket/-/socket-0.5.0.tgz" @@ -539,42 +1444,226 @@ dependencies: "@babel/runtime" "^7.13.10" +"@react-hook/latest@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@react-hook/latest/-/latest-1.0.3.tgz#c2d1d0b0af8b69ec6e2b3a2412ba0768ac82db80" + integrity sha512-dy6duzl+JnAZcDbNTfmaP3xHiKtbXYOaz3G51MGVljh548Y8MWzTr+PHLOfvpypEVW9zwvl+VyKjbWKEVbV1Rg== + +"@sideway/address@^4.1.3": + version "4.1.4" + resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0" + integrity sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@sideway/formula@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" + integrity sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg== + +"@sideway/pinpoint@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" + integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== + "@socket.io/component-emitter@~3.1.0": version "3.1.0" resolved "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz" integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg== -"@stitches/core@^1.2.8": - version "1.2.8" - resolved "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz" - integrity sha512-Gfkvwk9o9kE9r9XNBmJRfV8zONvXThnm1tcuojL04Uy5uRyqg93DC83lDebl0rocZCfKSjUv+fWYtMQmEDJldg== - -"@stitches/react@^1.2.8": - version "1.2.8" - resolved "https://registry.npmjs.org/@stitches/react/-/react-1.2.8.tgz" - integrity sha512-9g9dWI4gsSVe8bNLlb+lMkBYsnIKCZTmvqvDG+Avnn69XfmHZKiaMrx7cgTaddq7aTPPmXiTsbFcUy0xgI4+wA== +"@solana/buffer-layout@^4.0.0": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz#b996235eaec15b1e0b5092a8ed6028df77fa6c15" + integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA== + dependencies: + buffer "~6.0.3" -"@tanstack/query-async-storage-persister@4.29.23": - version "4.29.23" - resolved "https://registry.npmjs.org/@tanstack/query-async-storage-persister/-/query-async-storage-persister-4.29.23.tgz" - integrity sha512-TlUCpJTwqzHyniiSCyyqe2Dw/oq5iKc7U5nQLLT3qFKUSFUa8Y7SzaNiCGm6WxOr0e3zlDze+Dh4uHx7s7CGTw== +"@solana/web3.js@^1.70.1": + version "1.78.5" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.78.5.tgz#591cd47423cdb0b5e5cb7e8dc4dc70b2abe02f80" + integrity sha512-2ZHsDNqkKdglJQrIvJ3p2DmgS3cGnary3VJyqt9C1SPrpAtLYzcElr3xyXJOznyQTU/8AMw+GoF11lFoKbicKg== dependencies: - "@tanstack/query-persist-client-core" "4.29.23" + "@babel/runtime" "^7.22.6" + "@noble/curves" "^1.0.0" + "@noble/hashes" "^1.3.1" + "@solana/buffer-layout" "^4.0.0" + agentkeepalive "^4.3.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.0" + node-fetch "^2.6.12" + rpc-websockets "^7.5.1" + superstruct "^0.14.2" -"@tanstack/query-core@4.29.23": - version "4.29.23" - resolved "https://registry.npmjs.org/@tanstack/query-core/-/query-core-4.29.23.tgz" - integrity sha512-4BMHPrkfYmLP+NvqbbkV7Mk1nnphu+bNmxhhuB0+EMjKA7VfyFCfiyiTf55RRDgLaevyb9LrFK16lHW2owF52w== +"@stablelib/aead@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/aead/-/aead-1.0.1.tgz#c4b1106df9c23d1b867eb9b276d8f42d5fc4c0c3" + integrity sha512-q39ik6sxGHewqtO0nP4BuSe3db5G1fEJE8ukvngS2gLkBXyy6E7pLubhbYgnkDFv6V8cWaxcE4Xn0t6LWcJkyg== -"@tanstack/query-persist-client-core@4.29.23": - version "4.29.23" - resolved "https://registry.npmjs.org/@tanstack/query-persist-client-core/-/query-persist-client-core-4.29.23.tgz" - integrity sha512-u0P6y4DPeXeHEZnj0LEnhcgqX8x7iV7xbUDuoRPItUYsPn+anyLjXG3d3622+wLP3XKdevff0PhXkA7j9ZOWKg== +"@stablelib/binary@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/binary/-/binary-1.0.1.tgz#c5900b94368baf00f811da5bdb1610963dfddf7f" + integrity sha512-ClJWvmL6UBM/wjkvv/7m5VP3GMr9t0osr4yVgLZsLCOz4hGN9gIAFEqnJ0TsSMAN+n840nf2cHZnA5/KFqHC7Q== dependencies: - "@tanstack/query-core" "4.29.23" + "@stablelib/int" "^1.0.1" -"@tanstack/react-query-persist-client@4.29.23": - version "4.29.23" +"@stablelib/bytes@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/bytes/-/bytes-1.0.1.tgz#0f4aa7b03df3080b878c7dea927d01f42d6a20d8" + integrity sha512-Kre4Y4kdwuqL8BR2E9hV/R5sOrUj6NanZaZis0V6lX5yzqC3hBuVSDXUIBqQv/sCpmuWRiHLwqiT1pqqjuBXoQ== + +"@stablelib/chacha20poly1305@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/chacha20poly1305/-/chacha20poly1305-1.0.1.tgz#de6b18e283a9cb9b7530d8767f99cde1fec4c2ee" + integrity sha512-MmViqnqHd1ymwjOQfghRKw2R/jMIGT3wySN7cthjXCBdO+qErNPUBnRzqNpnvIwg7JBCg3LdeCZZO4de/yEhVA== + dependencies: + "@stablelib/aead" "^1.0.1" + "@stablelib/binary" "^1.0.1" + "@stablelib/chacha" "^1.0.1" + "@stablelib/constant-time" "^1.0.1" + "@stablelib/poly1305" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/chacha@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/chacha/-/chacha-1.0.1.tgz#deccfac95083e30600c3f92803a3a1a4fa761371" + integrity sha512-Pmlrswzr0pBzDofdFuVe1q7KdsHKhhU24e8gkEwnTGOmlC7PADzLVxGdn2PoNVBBabdg0l/IfLKg6sHAbTQugg== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/constant-time@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/constant-time/-/constant-time-1.0.1.tgz#bde361465e1cf7b9753061b77e376b0ca4c77e35" + integrity sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg== + +"@stablelib/ed25519@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@stablelib/ed25519/-/ed25519-1.0.3.tgz#f8fdeb6f77114897c887bb6a3138d659d3f35996" + integrity sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg== + dependencies: + "@stablelib/random" "^1.0.2" + "@stablelib/sha512" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/hash@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/hash/-/hash-1.0.1.tgz#3c944403ff2239fad8ebb9015e33e98444058bc5" + integrity sha512-eTPJc/stDkdtOcrNMZ6mcMK1e6yBbqRBaNW55XA1jU8w/7QdnCF0CmMmOD1m7VSkBR44PWrMHU2l6r8YEQHMgg== + +"@stablelib/hkdf@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/hkdf/-/hkdf-1.0.1.tgz#b4efd47fd56fb43c6a13e8775a54b354f028d98d" + integrity sha512-SBEHYE16ZXlHuaW5RcGk533YlBj4grMeg5TooN80W3NpcHRtLZLLXvKyX0qcRFxf+BGDobJLnwkvgEwHIDBR6g== + dependencies: + "@stablelib/hash" "^1.0.1" + "@stablelib/hmac" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/hmac@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/hmac/-/hmac-1.0.1.tgz#3d4c1b8cf194cb05d28155f0eed8a299620a07ec" + integrity sha512-V2APD9NSnhVpV/QMYgCVMIYKiYG6LSqw1S65wxVoirhU/51ACio6D4yDVSwMzuTJXWZoVHbDdINioBwKy5kVmA== + dependencies: + "@stablelib/constant-time" "^1.0.1" + "@stablelib/hash" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/int@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/int/-/int-1.0.1.tgz#75928cc25d59d73d75ae361f02128588c15fd008" + integrity sha512-byr69X/sDtDiIjIV6m4roLVWnNNlRGzsvxw+agj8CIEazqWGOQp2dTYgQhtyVXV9wpO6WyXRQUzLV/JRNumT2w== + +"@stablelib/keyagreement@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/keyagreement/-/keyagreement-1.0.1.tgz#4612efb0a30989deb437cd352cee637ca41fc50f" + integrity sha512-VKL6xBwgJnI6l1jKrBAfn265cspaWBPAPEc62VBQrWHLqVgNRE09gQ/AnOEyKUWrrqfD+xSQ3u42gJjLDdMDQg== + dependencies: + "@stablelib/bytes" "^1.0.1" + +"@stablelib/poly1305@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/poly1305/-/poly1305-1.0.1.tgz#93bfb836c9384685d33d70080718deae4ddef1dc" + integrity sha512-1HlG3oTSuQDOhSnLwJRKeTRSAdFNVB/1djy2ZbS35rBSJ/PFqx9cf9qatinWghC2UbfOYD8AcrtbUQl8WoxabA== + dependencies: + "@stablelib/constant-time" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/random@^1.0.1", "@stablelib/random@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@stablelib/random/-/random-1.0.2.tgz#2dece393636489bf7e19c51229dd7900eddf742c" + integrity sha512-rIsE83Xpb7clHPVRlBj8qNe5L8ISQOzjghYQm/dZ7VaM2KHYwMW5adjQjrzTZCchFnNCNhkwtnOBa9HTMJCI8w== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/sha256@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/sha256/-/sha256-1.0.1.tgz#77b6675b67f9b0ea081d2e31bda4866297a3ae4f" + integrity sha512-GIIH3e6KH+91FqGV42Kcj71Uefd/QEe7Dy42sBTeqppXV95ggCcxLTk39bEr+lZfJmp+ghsR07J++ORkRELsBQ== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/hash" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/sha512@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/sha512/-/sha512-1.0.1.tgz#6da700c901c2c0ceacbd3ae122a38ac57c72145f" + integrity sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/hash" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + +"@stablelib/wipe@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/wipe/-/wipe-1.0.1.tgz#d21401f1d59ade56a62e139462a97f104ed19a36" + integrity sha512-WfqfX/eXGiAd3RJe4VU2snh/ZPwtSjLG4ynQ/vYzvghTh7dHFcI1wl+nrkWG6lGhukOxOsUHfv8dUXr58D0ayg== + +"@stablelib/x25519@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@stablelib/x25519/-/x25519-1.0.3.tgz#13c8174f774ea9f3e5e42213cbf9fc68a3c7b7fd" + integrity sha512-KnTbKmUhPhHavzobclVJQG5kuivH+qDLpe84iRqX3CLrKp881cF160JvXJ+hjn1aMyCwYOKeIZefIH/P5cJoRw== + dependencies: + "@stablelib/keyagreement" "^1.0.1" + "@stablelib/random" "^1.0.2" + "@stablelib/wipe" "^1.0.1" + +"@stitches/core@^1.2.8": + version "1.2.8" + resolved "https://registry.npmjs.org/@stitches/core/-/core-1.2.8.tgz" + integrity sha512-Gfkvwk9o9kE9r9XNBmJRfV8zONvXThnm1tcuojL04Uy5uRyqg93DC83lDebl0rocZCfKSjUv+fWYtMQmEDJldg== + +"@stitches/react@^1.2.8": + version "1.2.8" + resolved "https://registry.npmjs.org/@stitches/react/-/react-1.2.8.tgz" + integrity sha512-9g9dWI4gsSVe8bNLlb+lMkBYsnIKCZTmvqvDG+Avnn69XfmHZKiaMrx7cgTaddq7aTPPmXiTsbFcUy0xgI4+wA== + +"@tanstack/query-async-storage-persister@4.29.23": + version "4.29.23" + resolved "https://registry.npmjs.org/@tanstack/query-async-storage-persister/-/query-async-storage-persister-4.29.23.tgz" + integrity sha512-TlUCpJTwqzHyniiSCyyqe2Dw/oq5iKc7U5nQLLT3qFKUSFUa8Y7SzaNiCGm6WxOr0e3zlDze+Dh4uHx7s7CGTw== + dependencies: + "@tanstack/query-persist-client-core" "4.29.23" + +"@tanstack/query-core@4.29.23": + version "4.29.23" + resolved "https://registry.npmjs.org/@tanstack/query-core/-/query-core-4.29.23.tgz" + integrity sha512-4BMHPrkfYmLP+NvqbbkV7Mk1nnphu+bNmxhhuB0+EMjKA7VfyFCfiyiTf55RRDgLaevyb9LrFK16lHW2owF52w== + +"@tanstack/query-persist-client-core@4.29.23": + version "4.29.23" + resolved "https://registry.npmjs.org/@tanstack/query-persist-client-core/-/query-persist-client-core-4.29.23.tgz" + integrity sha512-u0P6y4DPeXeHEZnj0LEnhcgqX8x7iV7xbUDuoRPItUYsPn+anyLjXG3d3622+wLP3XKdevff0PhXkA7j9ZOWKg== + dependencies: + "@tanstack/query-core" "4.29.23" + +"@tanstack/react-query-persist-client@4.29.23": + version "4.29.23" resolved "https://registry.npmjs.org/@tanstack/react-query-persist-client/-/react-query-persist-client-4.29.23.tgz" integrity sha512-P23y5CMGfSM943pJoQjjOdQXSHH/ohjAl8vhQp+40M4Nz3lDq2d39flGRpajyh4dl4C5s0R8V6Iii7kkIQo8Jg== dependencies: @@ -588,6 +1677,47 @@ "@tanstack/query-core" "4.29.23" use-sync-external-store "^1.2.0" +"@types/connect@^3.4.33": + version "3.4.36" + resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.36.tgz#e511558c15a39cb29bd5357eebb57bd1459cd1ab" + integrity sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w== + dependencies: + "@types/node" "*" + +"@types/debug@^4.1.7": + version "4.1.8" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" + integrity sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ== + dependencies: + "@types/ms" "*" + +"@types/ms@*": + version "0.7.31" + resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" + integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== + +"@types/node@*": + version "20.6.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.3.tgz#5b763b321cd3b80f6b8dde7a37e1a77ff9358dd9" + integrity sha512-HksnYH4Ljr4VQgEy2lTStbCKv/P590tmPe5HqOnv9Gprffgv5WXAY+Y5Gqniu0GGqeTCUdBnzC3QSrzPkBkAMA== + +"@types/node@^12.12.54": + version "12.20.55" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" + integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== + +"@types/trusted-types@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.3.tgz#a136f83b0758698df454e328759dbd3d44555311" + integrity sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g== + +"@types/ws@^7.4.4": + version "7.4.7" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702" + integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww== + dependencies: + "@types/node" "*" + "@unstoppabledomains/resolution@^8.5.0": version "8.5.0" resolved "https://registry.npmjs.org/@unstoppabledomains/resolution/-/resolution-8.5.0.tgz" @@ -599,6 +1729,465 @@ crypto-js "^4.1.1" elliptic "^6.5.4" +"@walletconnect/browser-utils@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz#33c10e777aa6be86c713095b5206d63d32df0951" + integrity sha512-Wcqqx+wjxIo9fv6eBUFHPsW1y/bGWWRboni5dfD8PtOmrihrEpOCmvRJe4rfl7xgJW8Ea9UqKEaq0bIRLHlK4A== + dependencies: + "@walletconnect/safe-json" "1.0.0" + "@walletconnect/types" "^1.8.0" + "@walletconnect/window-getters" "1.0.0" + "@walletconnect/window-metadata" "1.0.0" + detect-browser "5.2.0" + +"@walletconnect/client@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/client/-/client-1.8.0.tgz#6f46b5499c7c861c651ff1ebe5da5b66225ca696" + integrity sha512-svyBQ14NHx6Cs2j4TpkQaBI/2AF4+LXz64FojTjMtV4VMMhl81jSO1vNeg+yYhQzvjcGH/GpSwixjyCW0xFBOQ== + dependencies: + "@walletconnect/core" "^1.8.0" + "@walletconnect/iso-crypto" "^1.8.0" + "@walletconnect/types" "^1.8.0" + "@walletconnect/utils" "^1.8.0" + +"@walletconnect/core@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.10.0.tgz#b659de4dfb374becd938964abd4f2150d410e617" + integrity sha512-Z8pdorfIMueuiBXLdnf7yloiO9JIiobuxN3j0OTal+MYc4q5/2O7d+jdD1DAXbLi1taJx3x60UXT/FPVkjIqIQ== + dependencies: + "@walletconnect/heartbeat" "1.2.1" + "@walletconnect/jsonrpc-provider" "1.0.13" + "@walletconnect/jsonrpc-types" "1.0.3" + "@walletconnect/jsonrpc-utils" "1.0.8" + "@walletconnect/jsonrpc-ws-connection" "1.0.13" + "@walletconnect/keyvaluestorage" "^1.0.2" + "@walletconnect/logger" "^2.0.1" + "@walletconnect/relay-api" "^1.0.9" + "@walletconnect/relay-auth" "^1.0.4" + "@walletconnect/safe-json" "^1.0.2" + "@walletconnect/time" "^1.0.2" + "@walletconnect/types" "2.10.0" + "@walletconnect/utils" "2.10.0" + events "^3.3.0" + lodash.isequal "4.5.0" + uint8arrays "^3.1.0" + +"@walletconnect/core@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-1.8.0.tgz#6b2748b90c999d9d6a70e52e26a8d5e8bfeaa81e" + integrity sha512-aFTHvEEbXcZ8XdWBw6rpQDte41Rxwnuk3SgTD8/iKGSRTni50gI9S3YEzMj05jozSiOBxQci4pJDMVhIUMtarw== + dependencies: + "@walletconnect/socket-transport" "^1.8.0" + "@walletconnect/types" "^1.8.0" + "@walletconnect/utils" "^1.8.0" + +"@walletconnect/crypto@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@walletconnect/crypto/-/crypto-1.0.3.tgz#7b8dd4d7e2884fe3543c7c07aea425eef5ef9dd4" + integrity sha512-+2jdORD7XQs76I2Odgr3wwrtyuLUXD/kprNVsjWRhhhdO9Mt6WqVzOPu0/t7OHSmgal8k7SoBQzUc5hu/8zL/g== + dependencies: + "@walletconnect/encoding" "^1.0.2" + "@walletconnect/environment" "^1.0.1" + "@walletconnect/randombytes" "^1.0.3" + aes-js "^3.1.2" + hash.js "^1.1.7" + tslib "1.14.1" + +"@walletconnect/encoding@^1.0.1", "@walletconnect/encoding@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@walletconnect/encoding/-/encoding-1.0.2.tgz#cb3942ad038d6a6bf01158f66773062dd25724da" + integrity sha512-CrwSBrjqJ7rpGQcTL3kU+Ief+Bcuu9PH6JLOb+wM6NITX1GTxR/MfNwnQfhLKK6xpRAyj2/nM04OOH6wS8Imag== + dependencies: + is-typedarray "1.0.0" + tslib "1.14.1" + typedarray-to-buffer "3.1.5" + +"@walletconnect/environment@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@walletconnect/environment/-/environment-1.0.1.tgz#1d7f82f0009ab821a2ba5ad5e5a7b8ae3b214cd7" + integrity sha512-T426LLZtHj8e8rYnKfzsw1aG6+M0BT1ZxayMdv/p8yM0MU+eJDISqNY3/bccxRr4LrF9csq02Rhqt08Ibl0VRg== + dependencies: + tslib "1.14.1" + +"@walletconnect/ethereum-provider@^2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@walletconnect/ethereum-provider/-/ethereum-provider-2.10.0.tgz#eebde38674222a48be35bb4aa3f6a74247ba059b" + integrity sha512-NyTm7RcrtAiSaYQPh6G4sOtr1kg/pL5Z3EDE6rBTV3Se5pMsYvtuwMiSol7MidsQpf4ux9HFhthTO3imcoWImw== + dependencies: + "@walletconnect/jsonrpc-http-connection" "^1.0.7" + "@walletconnect/jsonrpc-provider" "^1.0.13" + "@walletconnect/jsonrpc-types" "^1.0.3" + "@walletconnect/jsonrpc-utils" "^1.0.8" + "@walletconnect/sign-client" "2.10.0" + "@walletconnect/types" "2.10.0" + "@walletconnect/universal-provider" "2.10.0" + "@walletconnect/utils" "2.10.0" + events "^3.3.0" + +"@walletconnect/events@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@walletconnect/events/-/events-1.0.1.tgz#2b5f9c7202019e229d7ccae1369a9e86bda7816c" + integrity sha512-NPTqaoi0oPBVNuLv7qPaJazmGHs5JGyO8eEAk5VGKmJzDR7AHzD4k6ilox5kxk1iwiOnFopBOOMLs86Oa76HpQ== + dependencies: + keyvaluestorage-interface "^1.0.0" + tslib "1.14.1" + +"@walletconnect/heartbeat@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@walletconnect/heartbeat/-/heartbeat-1.2.1.tgz#afaa3a53232ae182d7c9cff41c1084472d8f32e9" + integrity sha512-yVzws616xsDLJxuG/28FqtZ5rzrTA4gUjdEMTbWB5Y8V1XHRmqq4efAxCw5ie7WjbXFSUyBHaWlMR+2/CpQC5Q== + dependencies: + "@walletconnect/events" "^1.0.1" + "@walletconnect/time" "^1.0.2" + tslib "1.14.1" + +"@walletconnect/iso-crypto@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/iso-crypto/-/iso-crypto-1.8.0.tgz#44ddf337c4f02837c062dbe33fa7ab36789df451" + integrity sha512-pWy19KCyitpfXb70hA73r9FcvklS+FvO9QUIttp3c2mfW8frxgYeRXfxLRCIQTkaYueRKvdqPjbyhPLam508XQ== + dependencies: + "@walletconnect/crypto" "^1.0.2" + "@walletconnect/types" "^1.8.0" + "@walletconnect/utils" "^1.8.0" + +"@walletconnect/jsonrpc-http-connection@^1.0.7": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-http-connection/-/jsonrpc-http-connection-1.0.7.tgz#a6973569b8854c22da707a759d241e4f5c2d5a98" + integrity sha512-qlfh8fCfu8LOM9JRR9KE0s0wxP6ZG9/Jom8M0qsoIQeKF3Ni0FyV4V1qy/cc7nfI46SLQLSl4tgWSfLiE1swyQ== + dependencies: + "@walletconnect/jsonrpc-utils" "^1.0.6" + "@walletconnect/safe-json" "^1.0.1" + cross-fetch "^3.1.4" + tslib "1.14.1" + +"@walletconnect/jsonrpc-provider@1.0.13", "@walletconnect/jsonrpc-provider@^1.0.13": + version "1.0.13" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz#9a74da648d015e1fffc745f0c7d629457f53648b" + integrity sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g== + dependencies: + "@walletconnect/jsonrpc-utils" "^1.0.8" + "@walletconnect/safe-json" "^1.0.2" + tslib "1.14.1" + +"@walletconnect/jsonrpc-types@1.0.3", "@walletconnect/jsonrpc-types@^1.0.2", "@walletconnect/jsonrpc-types@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.3.tgz#65e3b77046f1a7fa8347ae02bc1b841abe6f290c" + integrity sha512-iIQ8hboBl3o5ufmJ8cuduGad0CQm3ZlsHtujv9Eu16xq89q+BG7Nh5VLxxUgmtpnrePgFkTwXirCTkwJH1v+Yw== + dependencies: + keyvaluestorage-interface "^1.0.0" + tslib "1.14.1" + +"@walletconnect/jsonrpc-utils@1.0.8", "@walletconnect/jsonrpc-utils@^1.0.3", "@walletconnect/jsonrpc-utils@^1.0.6", "@walletconnect/jsonrpc-utils@^1.0.7", "@walletconnect/jsonrpc-utils@^1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz#82d0cc6a5d6ff0ecc277cb35f71402c91ad48d72" + integrity sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw== + dependencies: + "@walletconnect/environment" "^1.0.1" + "@walletconnect/jsonrpc-types" "^1.0.3" + tslib "1.14.1" + +"@walletconnect/jsonrpc-ws-connection@1.0.13": + version "1.0.13" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.13.tgz#23b0cdd899801bfbb44a6556936ec2b93ef2adf4" + integrity sha512-mfOM7uFH4lGtQxG+XklYuFBj6dwVvseTt5/ahOkkmpcAEgz2umuzu7fTR+h5EmjQBdrmYyEBOWADbeaFNxdySg== + dependencies: + "@walletconnect/jsonrpc-utils" "^1.0.6" + "@walletconnect/safe-json" "^1.0.2" + events "^3.3.0" + tslib "1.14.1" + ws "^7.5.1" + +"@walletconnect/keyvaluestorage@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@walletconnect/keyvaluestorage/-/keyvaluestorage-1.0.2.tgz#92f5ca0f54c1a88a093778842ce0c874d86369c8" + integrity sha512-U/nNG+VLWoPFdwwKx0oliT4ziKQCEoQ27L5Hhw8YOFGA2Po9A9pULUYNWhDgHkrb0gYDNt//X7wABcEWWBd3FQ== + dependencies: + safe-json-utils "^1.1.1" + tslib "1.14.1" + +"@walletconnect/logger@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@walletconnect/logger/-/logger-2.0.1.tgz#7f489b96e9a1ff6bf3e58f0fbd6d69718bf844a8" + integrity sha512-SsTKdsgWm+oDTBeNE/zHxxr5eJfZmE9/5yp/Ku+zJtcTAjELb3DXueWkDXmE9h8uHIbJzIb5wj5lPdzyrjT6hQ== + dependencies: + pino "7.11.0" + tslib "1.14.1" + +"@walletconnect/mobile-registry@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@walletconnect/mobile-registry/-/mobile-registry-1.4.0.tgz#502cf8ab87330841d794819081e748ebdef7aee5" + integrity sha512-ZtKRio4uCZ1JUF7LIdecmZt7FOLnX72RPSY7aUVu7mj7CSfxDwUn6gBuK6WGtH+NZCldBqDl5DenI5fFSvkKYw== + +"@walletconnect/modal-core@2.6.1": + version "2.6.1" + resolved "https://registry.yarnpkg.com/@walletconnect/modal-core/-/modal-core-2.6.1.tgz#bc76055d0b644a2d4b98024324825c108a700905" + integrity sha512-f2hYlJ5pwzGvjyaZ6BoGR5uiMgXzWXt6w6ktt1N8lmY6PiYp8whZgqx2hTxVWwVlsGnaIfh6UHp1hGnANx0eTQ== + dependencies: + valtio "1.11.0" + +"@walletconnect/modal-ui@2.6.1": + version "2.6.1" + resolved "https://registry.yarnpkg.com/@walletconnect/modal-ui/-/modal-ui-2.6.1.tgz#200c54c8dfe3c71321abb2724e18bb357dfd6371" + integrity sha512-RFUOwDAMijSK8B7W3+KoLKaa1l+KEUG0LCrtHqaB0H0cLnhEGdLR+kdTdygw+W8+yYZbkM5tXBm7MlFbcuyitA== + dependencies: + "@walletconnect/modal-core" "2.6.1" + lit "2.7.6" + motion "10.16.2" + qrcode "1.5.3" + +"@walletconnect/modal@2.6.1": + version "2.6.1" + resolved "https://registry.yarnpkg.com/@walletconnect/modal/-/modal-2.6.1.tgz#066fdbfcff83b58c8a9da66ab4af0eb93e3626de" + integrity sha512-G84tSzdPKAFk1zimgV7JzIUFT5olZUVtI3GcOk77OeLYjlMfnDT23RVRHm5EyCrjkptnvpD0wQScXePOFd2Xcw== + dependencies: + "@walletconnect/modal-core" "2.6.1" + "@walletconnect/modal-ui" "2.6.1" + +"@walletconnect/qrcode-modal@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/qrcode-modal/-/qrcode-modal-1.8.0.tgz#ddd6f5c9b7ee52c16adf9aacec2a3eac4994caea" + integrity sha512-BueaFefaAi8mawE45eUtztg3ZFbsAH4DDXh1UNwdUlsvFMjqcYzLUG0xZvDd6z2eOpbgDg2N3bl6gF0KONj1dg== + dependencies: + "@walletconnect/browser-utils" "^1.8.0" + "@walletconnect/mobile-registry" "^1.4.0" + "@walletconnect/types" "^1.8.0" + copy-to-clipboard "^3.3.1" + preact "10.4.1" + qrcode "1.4.4" + +"@walletconnect/randombytes@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@walletconnect/randombytes/-/randombytes-1.0.3.tgz#e795e4918367fd1e6a2215e075e64ab93e23985b" + integrity sha512-35lpzxcHFbTN3ABefC9W+uBpNZl1GC4Wpx0ed30gibfO/y9oLdy1NznbV96HARQKSBV9J9M/rrtIvf6a23jfYw== + dependencies: + "@walletconnect/encoding" "^1.0.2" + "@walletconnect/environment" "^1.0.1" + randombytes "^2.1.0" + tslib "1.14.1" + +"@walletconnect/relay-api@^1.0.9": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.9.tgz#f8c2c3993dddaa9f33ed42197fc9bfebd790ecaf" + integrity sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg== + dependencies: + "@walletconnect/jsonrpc-types" "^1.0.2" + tslib "1.14.1" + +"@walletconnect/relay-auth@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz#0b5c55c9aa3b0ef61f526ce679f3ff8a5c4c2c7c" + integrity sha512-kKJcS6+WxYq5kshpPaxGHdwf5y98ZwbfuS4EE/NkQzqrDFm5Cj+dP8LofzWvjrrLkZq7Afy7WrQMXdLy8Sx7HQ== + dependencies: + "@stablelib/ed25519" "^1.0.2" + "@stablelib/random" "^1.0.1" + "@walletconnect/safe-json" "^1.0.1" + "@walletconnect/time" "^1.0.2" + tslib "1.14.1" + uint8arrays "^3.0.0" + +"@walletconnect/safe-json@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/safe-json/-/safe-json-1.0.0.tgz#12eeb11d43795199c045fafde97e3c91646683b2" + integrity sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg== + +"@walletconnect/safe-json@^1.0.1", "@walletconnect/safe-json@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@walletconnect/safe-json/-/safe-json-1.0.2.tgz#7237e5ca48046e4476154e503c6d3c914126fa77" + integrity sha512-Ogb7I27kZ3LPC3ibn8ldyUr5544t3/STow9+lzz7Sfo808YD7SBWk7SAsdBFlYgP2zDRy2hS3sKRcuSRM0OTmA== + dependencies: + tslib "1.14.1" + +"@walletconnect/sign-client@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.10.0.tgz#0fee8f12821e37783099f0c7bd64e6efdfbd9d86" + integrity sha512-hbDljDS53kR/It3oXD91UkcOsT6diNnW5+Zzksm0YEfwww5dop/YfNlcdnc8+jKUhWOL/YDPNQCjzsCSNlVzbw== + dependencies: + "@walletconnect/core" "2.10.0" + "@walletconnect/events" "^1.0.1" + "@walletconnect/heartbeat" "1.2.1" + "@walletconnect/jsonrpc-utils" "1.0.8" + "@walletconnect/logger" "^2.0.1" + "@walletconnect/time" "^1.0.2" + "@walletconnect/types" "2.10.0" + "@walletconnect/utils" "2.10.0" + events "^3.3.0" + +"@walletconnect/socket-transport@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/socket-transport/-/socket-transport-1.8.0.tgz#9a1128a249628a0be11a0979b522fe82b44afa1b" + integrity sha512-5DyIyWrzHXTcVp0Vd93zJ5XMW61iDM6bcWT4p8DTRfFsOtW46JquruMhxOLeCOieM4D73kcr3U7WtyR4JUsGuQ== + dependencies: + "@walletconnect/types" "^1.8.0" + "@walletconnect/utils" "^1.8.0" + ws "7.5.3" + +"@walletconnect/time@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@walletconnect/time/-/time-1.0.2.tgz#6c5888b835750ecb4299d28eecc5e72c6d336523" + integrity sha512-uzdd9woDcJ1AaBZRhqy5rNC9laqWGErfc4dxA9a87mPdKOgWMD85mcFo9dIYIts/Jwocfwn07EC6EzclKubk/g== + dependencies: + tslib "1.14.1" + +"@walletconnect/types@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.10.0.tgz#5d63235b49e03d609521402a4b49627dbc4ed514" + integrity sha512-kSTA/WZnbKdEbvbXSW16Ty6dOSzOZCHnGg6JH7q1MuraalD2HuNg00lVVu7QAZ/Rj1Gn9DAkrgP5Wd5a8Xq//Q== + dependencies: + "@walletconnect/events" "^1.0.1" + "@walletconnect/heartbeat" "1.2.1" + "@walletconnect/jsonrpc-types" "1.0.3" + "@walletconnect/keyvaluestorage" "^1.0.2" + "@walletconnect/logger" "^2.0.1" + events "^3.3.0" + +"@walletconnect/types@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-1.8.0.tgz#3f5e85b2d6b149337f727ab8a71b8471d8d9a195" + integrity sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg== + +"@walletconnect/universal-provider@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@walletconnect/universal-provider/-/universal-provider-2.10.0.tgz#565d6478dcb5cc66955e5f03d6a00f51c9bcac14" + integrity sha512-jtVWf+AeTCqBcB3lCmWkv3bvSmdRCkQdo67GNoT5y6/pvVHMxfjgrJNBOUsWQMxpREpWDpZ993X0JRjsYVsMcA== + dependencies: + "@walletconnect/jsonrpc-http-connection" "^1.0.7" + "@walletconnect/jsonrpc-provider" "1.0.13" + "@walletconnect/jsonrpc-types" "^1.0.2" + "@walletconnect/jsonrpc-utils" "^1.0.7" + "@walletconnect/logger" "^2.0.1" + "@walletconnect/sign-client" "2.10.0" + "@walletconnect/types" "2.10.0" + "@walletconnect/utils" "2.10.0" + events "^3.3.0" + +"@walletconnect/utils@2.10.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.10.0.tgz#6918d12180d797b8bd4a19fb2ff128e394e181d6" + integrity sha512-9GRyEz/7CJW+G04RvrjPET5k7hOEsB9b3fF9cWDk/iDCxSWpbkU/hv/urRB36C+gvQMAZgIZYX3dHfzJWkY/2g== + dependencies: + "@stablelib/chacha20poly1305" "1.0.1" + "@stablelib/hkdf" "1.0.1" + "@stablelib/random" "^1.0.2" + "@stablelib/sha256" "1.0.1" + "@stablelib/x25519" "^1.0.3" + "@walletconnect/relay-api" "^1.0.9" + "@walletconnect/safe-json" "^1.0.2" + "@walletconnect/time" "^1.0.2" + "@walletconnect/types" "2.10.0" + "@walletconnect/window-getters" "^1.0.1" + "@walletconnect/window-metadata" "^1.0.1" + detect-browser "5.3.0" + query-string "7.1.3" + uint8arrays "^3.1.0" + +"@walletconnect/utils@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-1.8.0.tgz#2591a197c1fa7429941fe428876088fda6632060" + integrity sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA== + dependencies: + "@walletconnect/browser-utils" "^1.8.0" + "@walletconnect/encoding" "^1.0.1" + "@walletconnect/jsonrpc-utils" "^1.0.3" + "@walletconnect/types" "^1.8.0" + bn.js "4.11.8" + js-sha3 "0.8.0" + query-string "6.13.5" + +"@walletconnect/window-getters@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/window-getters/-/window-getters-1.0.0.tgz#1053224f77e725dfd611c83931b5f6c98c32bfc8" + integrity sha512-xB0SQsLaleIYIkSsl43vm8EwETpBzJ2gnzk7e0wMF3ktqiTGS6TFHxcprMl5R44KKh4tCcHCJwolMCaDSwtAaA== + +"@walletconnect/window-getters@^1.0.0", "@walletconnect/window-getters@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@walletconnect/window-getters/-/window-getters-1.0.1.tgz#f36d1c72558a7f6b87ecc4451fc8bd44f63cbbdc" + integrity sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q== + dependencies: + tslib "1.14.1" + +"@walletconnect/window-metadata@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@walletconnect/window-metadata/-/window-metadata-1.0.0.tgz#93b1cc685e6b9b202f29c26be550fde97800c4e5" + integrity sha512-9eFvmJxIKCC3YWOL97SgRkKhlyGXkrHwamfechmqszbypFspaSk+t2jQXAEU7YClHF6Qjw5eYOmy1//zFi9/GA== + dependencies: + "@walletconnect/window-getters" "^1.0.0" + +"@walletconnect/window-metadata@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@walletconnect/window-metadata/-/window-metadata-1.0.1.tgz#2124f75447b7e989e4e4e1581d55d25bc75f7be5" + integrity sha512-9koTqyGrM2cqFRW517BPY/iEtUDx2r1+Pwwu5m7sJ7ka79wi3EyqhqcICk/yDmv6jAS1rjKgTKXlEhanYjijcA== + dependencies: + "@walletconnect/window-getters" "^1.0.1" + tslib "1.14.1" + +"@web3-onboard/coinbase@^2.2.5": + version "2.2.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/coinbase/-/coinbase-2.2.5.tgz#fb7a57e5456323c0ee107ce48ea0cc80acbb6e07" + integrity sha512-mEiaK+K+nB2TwxUpkyAZmb4AHguymsJrHFbsZDdAolFTgZizCSjGHBhYlCEfxLL4fh3CpUryTa/AaNxxhdG6OQ== + dependencies: + "@coinbase/wallet-sdk" "^3.7.1" + "@web3-onboard/common" "^2.3.3" + +"@web3-onboard/common@^2.3.3": + version "2.3.3" + resolved "https://registry.yarnpkg.com/@web3-onboard/common/-/common-2.3.3.tgz#02096e967dbed272c0637cda955902b96a0fce06" + integrity sha512-Ytppszqe77VY8WglRdr/Lfx+HmcZ2hXQEkBA23JaVYmzKvP/mC6j+sjGUD8CgXDpRRxyKoiRj6nz95GRABie6Q== + dependencies: + bignumber.js "^9.1.0" + ethers "5.5.4" + joi "17.9.1" + +"@web3-onboard/core@^2.21.1": + version "2.21.1" + resolved "https://registry.yarnpkg.com/@web3-onboard/core/-/core-2.21.1.tgz#addb6c07c376cbbed3ae1d9ea6aabf05b15a8309" + integrity sha512-2ETfh+MIcRdEq1fY3+hc4KDTVelJLzNK9SpiH58kZ43/G5ky5IuTRS22e0xpsn/4pq5a1Y0Pgc1tHQncyZpndw== + dependencies: + "@web3-onboard/common" "^2.3.3" + bignumber.js "^9.0.0" + bnc-sdk "^4.6.7" + bowser "^2.11.0" + ethers "5.5.3" + eventemitter3 "^4.0.7" + joi "17.9.1" + lodash.merge "^4.6.2" + lodash.partition "^4.6.0" + nanoid "^4.0.0" + rxjs "^7.5.5" + svelte "^3.49.0" + svelte-i18n "^3.3.13" + +"@web3-onboard/injected-wallets@^2.10.5": + version "2.10.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/injected-wallets/-/injected-wallets-2.10.5.tgz#dde00818d184ba5d75034ef425676e8dfe01739b" + integrity sha512-pbjCrGHs2ydrGJ3gzm1mf6mhqNpnptWpbEr3hUOwyUZVnnQNGiWOP0bZHVSNqG2Xj061z2jhprugmjO4kenqBQ== + dependencies: + "@web3-onboard/common" "^2.3.3" + joi "17.9.1" + lodash.uniqby "^4.7.0" + +"@web3-onboard/react@^2.8.9": + version "2.8.12" + resolved "https://registry.yarnpkg.com/@web3-onboard/react/-/react-2.8.12.tgz#5ab28aa2a038d3a4ba66d4178b87fc27f2f5be92" + integrity sha512-OqG24441XLf+hisy2KkHR3ZmLnleVmRRXeCpa4KHf9j7LtcBhGWOZlIjwFpVq/tk+r6/9piteweOxiqANObAIA== + dependencies: + "@web3-onboard/common" "^2.3.3" + "@web3-onboard/core" "^2.21.1" + use-sync-external-store "1.0.0" + +"@web3-onboard/walletconnect@^2.4.6": + version "2.4.6" + resolved "https://registry.yarnpkg.com/@web3-onboard/walletconnect/-/walletconnect-2.4.6.tgz#305b16a022f915356fd8b7547c89858bbd10498c" + integrity sha512-HsJHC++1/RSZIbYWGLCKkkmdu+8ITV3hkBeSQxvrnO9bcCBMY//+SBo2N7hPZqqSiRFvv2/UW4r4hELmhR4pdQ== + dependencies: + "@ethersproject/providers" "5.5.0" + "@walletconnect/client" "^1.8.0" + "@walletconnect/ethereum-provider" "^2.10.0" + "@walletconnect/modal" "2.6.1" + "@walletconnect/qrcode-modal" "^1.8.0" + "@web3-onboard/common" "^2.3.3" + joi "17.9.1" + rxjs "^7.5.2" + "@web3-react/abstract-connector@^6.0.7": version "6.0.7" resolved "https://registry.yarnpkg.com/@web3-react/abstract-connector/-/abstract-connector-6.0.7.tgz#401b3c045f1e0fab04256311be49d5144e9badc6" @@ -620,6 +2209,55 @@ resolved "https://registry.yarnpkg.com/@web3-react/types/-/types-6.0.7.tgz#34a6204224467eedc6123abaf55fbb6baeb2809f" integrity sha512-ofGmfDhxmNT1/P/MgVa8IKSkCStFiyvXe+U5tyZurKdrtTDFU+wJ/LxClPDtFerWpczNFPUSrKcuhfPX1sI6+A== +JSONStream@^1.3.5: + version "1.3.5" + resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" + integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + +aes-js@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" + integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== + +aes-js@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a" + integrity sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ== + +agentkeepalive@^4.3.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" + integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== + dependencies: + humanize-ms "^1.2.1" + +ansi-regex@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" + integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== + dependencies: + color-convert "^1.9.0" + +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + aria-hidden@^1.1.1: version "1.2.3" resolved "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.3.tgz" @@ -627,31 +2265,236 @@ aria-hidden@^1.1.1: dependencies: tslib "^2.0.0" +async-mutex@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/async-mutex/-/async-mutex-0.2.6.tgz#0d7a3deb978bc2b984d5908a2038e1ae2e54ff40" + integrity sha512-Hs4R+4SPgamu6rSGW8C7cV9gaWUKEHykfzCCvIRuaVv636Ju10ZdeUbvb4TBEW0INuq2DHZqXbK4Nd3yG4RaRw== + dependencies: + tslib "^2.0.0" + +atomic-sleep@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" + integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== + +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== + +base-x@^3.0.2: + version "3.0.9" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320" + integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ== + dependencies: + safe-buffer "^5.0.1" + +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + +bech32@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" + integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== + +bigint-buffer@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/bigint-buffer/-/bigint-buffer-1.1.5.tgz#d038f31c8e4534c1f8d0015209bf34b4fa6dd442" + integrity sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA== + dependencies: + bindings "^1.3.0" + +bignumber.js@^9.0.0, bignumber.js@^9.1.0: + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== + +bind-decorator@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/bind-decorator/-/bind-decorator-1.0.11.tgz#e41bc06a1f65dd9cec476c91c5daf3978488252f" + integrity sha512-yzkH0uog6Vv/vQ9+rhSKxecnqGUZHYncg7qS7voz3Q76+TAi1SGiOKk2mlOvusQnFz9Dc4BC/NMkeXu11YgjJg== + +bindings@^1.3.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + +bn.js@4.11.8: + version "4.11.8" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" + integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + bn.js@^4.11.9, bn.js@^4.4.0: version "4.12.0" resolved "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.2.1: +bn.js@^5.1.1, bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== +bnc-sdk@^4.6.7: + version "4.6.7" + resolved "https://registry.yarnpkg.com/bnc-sdk/-/bnc-sdk-4.6.7.tgz#138a22e04c95c2c697fb836092358d21957e2114" + integrity sha512-jIQ6cmeRBgvH/YDLuYRr2+kxDGcAAi0SOvjlO5nQ5cWdbslw+ASWftd1HmxiVLNCiwEH5bSc/t8a0agZ5njTUQ== + dependencies: + crypto-es "^1.2.2" + nanoid "^3.3.1" + rxjs "^6.6.3" + sturdy-websocket "^0.1.12" + +borsh@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a" + integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA== + dependencies: + bn.js "^5.2.0" + bs58 "^4.0.0" + text-encoding-utf-8 "^1.0.2" + +bowser@^2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f" + integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA== + brorand@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== -buffer-from@^1.1.2: +bs58@^4.0.0, bs58@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" + integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== + dependencies: + base-x "^3.0.2" + +buffer-alloc-unsafe@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0" + integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg== + +buffer-alloc@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec" + integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow== + dependencies: + buffer-alloc-unsafe "^1.1.0" + buffer-fill "^1.0.0" + +buffer-fill@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" + integrity sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ== + +buffer-from@^1.1.1, buffer-from@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -clsx@^1.1.1, clsx@^1.2.1: +buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + +buffer@^5.4.3: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + +bufferutil@^4.0.1: + version "4.0.7" + resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad" + integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw== + dependencies: + node-gyp-build "^4.3.0" + +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + +camelcase@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== + +cli-color@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.3.tgz#73769ba969080629670f3f2ef69a4bf4e7cc1879" + integrity sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.61" + es6-iterator "^2.0.3" + memoizee "^0.4.15" + timers-ext "^0.1.7" + +cliui@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" + integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== + dependencies: + string-width "^3.1.0" + strip-ansi "^5.2.0" + wrap-ansi "^5.1.0" + +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + +clsx@^1.1.0, clsx@^1.1.1, clsx@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== +clsx@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/clsx/-/clsx-2.0.0.tgz#12658f3fd98fafe62075595a5c30e43d18f3d00b" + integrity sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q== +color-convert@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== + dependencies: + color-name "1.1.3" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + combine-errors@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/combine-errors/-/combine-errors-3.0.3.tgz" @@ -660,6 +2503,18 @@ combine-errors@^3.0.3: custom-error-instance "2.1.1" lodash.uniqby "4.5.0" +commander@^2.20.3: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +copy-to-clipboard@^3.3.1: + version "3.3.3" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" + integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== + dependencies: + toggle-selection "^1.0.6" + core-js@^3.31.1: version "3.32.0" resolved "https://registry.npmjs.org/core-js/-/core-js-3.32.0.tgz" @@ -679,6 +2534,11 @@ cross-fetch@^4.0.0: dependencies: node-fetch "^2.6.12" +crypto-es@^1.2.2: + version "1.2.7" + resolved "https://registry.yarnpkg.com/crypto-es/-/crypto-es-1.2.7.tgz#754a6d52319a94fb4eb1f119297f17196b360f88" + integrity sha512-UUqiVJ2gUuZFmbFsKmud3uuLcNP2+Opt+5ysmljycFCyhA0+T16XJmo1ev/t5kMChMqWh7IEvURNCqsg+SjZGQ== + crypto-js@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz" @@ -689,6 +2549,14 @@ custom-error-instance@2.1.1: resolved "https://registry.npmjs.org/custom-error-instance/-/custom-error-instance-2.1.1.tgz" integrity sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg== +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + date-fns@^2.28.0: version "2.30.0" resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz" @@ -696,18 +2564,53 @@ date-fns@^2.28.0: dependencies: "@babel/runtime" "^7.21.0" -debug@~4.3.1, debug@~4.3.2: +debug@^4.3.4, debug@~4.3.1, debug@~4.3.2: version "4.3.4" resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" +decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== + +decode-uri-component@^0.2.0, decode-uri-component@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== + +deepmerge@^4.2.2: + version "4.3.1" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== + +delay@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d" + integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw== + +detect-browser@5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.2.0.tgz#c9cd5afa96a6a19fda0bbe9e9be48a6b6e1e9c97" + integrity sha512-tr7XntDAu50BVENgQfajMLzacmSe34D+qZc4zjnniz0ZVuw/TZcLcyxHQjYpJTM36sGEkZZlYLnIM1hH7alTMA== + +detect-browser@5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.3.0.tgz#9705ef2bddf46072d0f7265a1fe300e36fe7ceca" + integrity sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w== + detect-node-es@^1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz" integrity sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ== +dijkstrajs@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/dijkstrajs/-/dijkstrajs-1.0.3.tgz#4c8dbdea1f0f6478bff94d9c49c784d623e4fc23" + integrity sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA== + dom-serializer@^1.0.1: version "1.4.1" resolved "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz" @@ -738,6 +2641,16 @@ domutils@^2.8.0: domelementtype "^2.2.0" domhandler "^4.2.0" +duplexify@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.2.tgz#18b4f8d28289132fa0b9573c898d9f903f81c7b0" + integrity sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.0" + elliptic@6.5.4, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz" @@ -751,6 +2664,11 @@ elliptic@6.5.4, elliptic@^6.5.4: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" +email-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/email-regex/-/email-regex-5.0.0.tgz#c8b1f4c7f251929b53586a7a3891da09c8dea26d" + integrity sha512-he76Cm8JFxb6OGQHabLBPdsiStgPmJeAEhctmw0uhonUh1pCBsHpI6/rB62s2GNzjBb0YlhIcF/1l9Lp5AfH0Q== + emoji-picker-react@^4.4.9: version "4.4.10" resolved "https://registry.npmjs.org/emoji-picker-react/-/emoji-picker-react-4.4.10.tgz" @@ -758,6 +2676,28 @@ emoji-picker-react@^4.4.9: dependencies: clsx "^1.2.1" +emoji-regex@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" + integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +encode-utf8@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/encode-utf8/-/encode-utf8-1.0.3.tgz#f30fdd31da07fb596f281beb2f6b027851994cda" + integrity sha512-ucAnuBEhUK4boH2HjVYG5Q2mQyPorvv0u/ocS+zhdw0S8AlHYY+GOFhP1Gio5z4icpP2ivFSvhtFjQi8+T9ppw== + +end-of-stream@^1.4.1: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + engine.io-client@~6.4.0: version "6.4.0" resolved "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.4.0.tgz" @@ -784,11 +2724,345 @@ entities@^3.0.1: resolved "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz" integrity sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q== +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.62" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" + integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== + dependencies: + es6-iterator "^2.0.3" + es6-symbol "^3.1.3" + next-tick "^1.1.0" + +es6-iterator@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-promise@^4.0.3: + version "4.2.8" + resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" + integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== + +es6-promisify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ== + dependencies: + es6-promise "^4.0.3" + +es6-symbol@^3.1.1, es6-symbol@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +es6-weak-map@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== + dependencies: + d "1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" + es6-symbol "^3.1.1" + +esbuild@^0.19.2: + version "0.19.2" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.2.tgz#b1541828a89dfb6f840d38538767c6130dca2aac" + integrity sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg== + optionalDependencies: + "@esbuild/android-arm" "0.19.2" + "@esbuild/android-arm64" "0.19.2" + "@esbuild/android-x64" "0.19.2" + "@esbuild/darwin-arm64" "0.19.2" + "@esbuild/darwin-x64" "0.19.2" + "@esbuild/freebsd-arm64" "0.19.2" + "@esbuild/freebsd-x64" "0.19.2" + "@esbuild/linux-arm" "0.19.2" + "@esbuild/linux-arm64" "0.19.2" + "@esbuild/linux-ia32" "0.19.2" + "@esbuild/linux-loong64" "0.19.2" + "@esbuild/linux-mips64el" "0.19.2" + "@esbuild/linux-ppc64" "0.19.2" + "@esbuild/linux-riscv64" "0.19.2" + "@esbuild/linux-s390x" "0.19.2" + "@esbuild/linux-x64" "0.19.2" + "@esbuild/netbsd-x64" "0.19.2" + "@esbuild/openbsd-x64" "0.19.2" + "@esbuild/sunos-x64" "0.19.2" + "@esbuild/win32-arm64" "0.19.2" + "@esbuild/win32-ia32" "0.19.2" + "@esbuild/win32-x64" "0.19.2" + +estree-walker@^2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + +eth-block-tracker@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/eth-block-tracker/-/eth-block-tracker-6.1.0.tgz#0481f97bbb88a100b9d45806fe7e37af741cbefc" + integrity sha512-K9SY8+/xMBi4M5HHTDdxnpEqEEGjbNpzHFqvxyjMZej8InV/B+CkFRKM6W+uvrFJ7m8Zd1E0qUkseU3vdIDFYQ== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + "@metamask/utils" "^3.0.1" + json-rpc-random-id "^1.0.1" + pify "^3.0.0" + +eth-json-rpc-filters@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eth-json-rpc-filters/-/eth-json-rpc-filters-5.1.0.tgz#f0c2aeaec2a45e2dc6ca1b9843d8e85447821427" + integrity sha512-fos+9xmoa1A2Ytsc9eYof17r81BjdJOUcGcgZn4K/tKdCCTb+a8ytEtwlu1op5qsXFDlgGmstTELFrDEc89qEQ== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + async-mutex "^0.2.6" + eth-query "^2.1.2" + json-rpc-engine "^6.1.0" + pify "^5.0.0" + +eth-query@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/eth-query/-/eth-query-2.1.2.tgz#d6741d9000106b51510c72db92d6365456a6da5e" + integrity sha512-srES0ZcvwkR/wd5OQBRA1bIJMww1skfGS0s8wlwK3/oNP4+wnds60krvu5R1QbpRQjMmpG5OMIWro5s7gvDPsA== + dependencies: + json-rpc-random-id "^1.0.0" + xtend "^4.0.1" + +eth-rpc-errors@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.2.tgz#11bc164e25237a679061ac05b7da7537b673d3b7" + integrity sha512-n+Re6Gu8XGyfFy1it0AwbD1x0MUzspQs0D5UiPs1fFPCr6WAwZM+vbIhXheBFrpgosqN9bs5PqlB4Q61U/QytQ== + dependencies: + fast-safe-stringify "^2.0.6" + +eth-rpc-errors@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/eth-rpc-errors/-/eth-rpc-errors-4.0.3.tgz#6ddb6190a4bf360afda82790bb7d9d5e724f423a" + integrity sha512-Z3ymjopaoft7JDoxZcEb3pwdGh7yiYMhOwm2doUt6ASXlMavpNlK6Cre0+IMl2VSGyEU9rkiperQhp5iRxn5Pg== + dependencies: + fast-safe-stringify "^2.0.6" + +ethers@5.5.3: + version "5.5.3" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.5.3.tgz#1e361516711c0c3244b6210e7e3ecabf0c75fca0" + integrity sha512-fTT4WT8/hTe/BLwRUtl7I5zlpF3XC3P/Xwqxc5AIP2HGlH15qpmjs0Ou78az93b1rLITzXLFxoNX63B8ZbUd7g== + dependencies: + "@ethersproject/abi" "5.5.0" + "@ethersproject/abstract-provider" "5.5.1" + "@ethersproject/abstract-signer" "5.5.0" + "@ethersproject/address" "5.5.0" + "@ethersproject/base64" "5.5.0" + "@ethersproject/basex" "5.5.0" + "@ethersproject/bignumber" "5.5.0" + "@ethersproject/bytes" "5.5.0" + "@ethersproject/constants" "5.5.0" + "@ethersproject/contracts" "5.5.0" + "@ethersproject/hash" "5.5.0" + "@ethersproject/hdnode" "5.5.0" + "@ethersproject/json-wallets" "5.5.0" + "@ethersproject/keccak256" "5.5.0" + "@ethersproject/logger" "5.5.0" + "@ethersproject/networks" "5.5.2" + "@ethersproject/pbkdf2" "5.5.0" + "@ethersproject/properties" "5.5.0" + "@ethersproject/providers" "5.5.2" + "@ethersproject/random" "5.5.1" + "@ethersproject/rlp" "5.5.0" + "@ethersproject/sha2" "5.5.0" + "@ethersproject/signing-key" "5.5.0" + "@ethersproject/solidity" "5.5.0" + "@ethersproject/strings" "5.5.0" + "@ethersproject/transactions" "5.5.0" + "@ethersproject/units" "5.5.0" + "@ethersproject/wallet" "5.5.0" + "@ethersproject/web" "5.5.1" + "@ethersproject/wordlists" "5.5.0" + +ethers@5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.5.4.tgz#e1155b73376a2f5da448e4a33351b57a885f4352" + integrity sha512-N9IAXsF8iKhgHIC6pquzRgPBJEzc9auw3JoRkaKe+y4Wl/LFBtDDunNe7YmdomontECAcC5APaAgWZBiu1kirw== + dependencies: + "@ethersproject/abi" "5.5.0" + "@ethersproject/abstract-provider" "5.5.1" + "@ethersproject/abstract-signer" "5.5.0" + "@ethersproject/address" "5.5.0" + "@ethersproject/base64" "5.5.0" + "@ethersproject/basex" "5.5.0" + "@ethersproject/bignumber" "5.5.0" + "@ethersproject/bytes" "5.5.0" + "@ethersproject/constants" "5.5.0" + "@ethersproject/contracts" "5.5.0" + "@ethersproject/hash" "5.5.0" + "@ethersproject/hdnode" "5.5.0" + "@ethersproject/json-wallets" "5.5.0" + "@ethersproject/keccak256" "5.5.0" + "@ethersproject/logger" "5.5.0" + "@ethersproject/networks" "5.5.2" + "@ethersproject/pbkdf2" "5.5.0" + "@ethersproject/properties" "5.5.0" + "@ethersproject/providers" "5.5.3" + "@ethersproject/random" "5.5.1" + "@ethersproject/rlp" "5.5.0" + "@ethersproject/sha2" "5.5.0" + "@ethersproject/signing-key" "5.5.0" + "@ethersproject/solidity" "5.5.0" + "@ethersproject/strings" "5.5.0" + "@ethersproject/transactions" "5.5.0" + "@ethersproject/units" "5.5.0" + "@ethersproject/wallet" "5.5.0" + "@ethersproject/web" "5.5.1" + "@ethersproject/wordlists" "5.5.0" + +ethers@^5.6.8: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== + dependencies: + "@ethersproject/abi" "5.7.0" + "@ethersproject/abstract-provider" "5.7.0" + "@ethersproject/abstract-signer" "5.7.0" + "@ethersproject/address" "5.7.0" + "@ethersproject/base64" "5.7.0" + "@ethersproject/basex" "5.7.0" + "@ethersproject/bignumber" "5.7.0" + "@ethersproject/bytes" "5.7.0" + "@ethersproject/constants" "5.7.0" + "@ethersproject/contracts" "5.7.0" + "@ethersproject/hash" "5.7.0" + "@ethersproject/hdnode" "5.7.0" + "@ethersproject/json-wallets" "5.7.0" + "@ethersproject/keccak256" "5.7.0" + "@ethersproject/logger" "5.7.0" + "@ethersproject/networks" "5.7.1" + "@ethersproject/pbkdf2" "5.7.0" + "@ethersproject/properties" "5.7.0" + "@ethersproject/providers" "5.7.2" + "@ethersproject/random" "5.7.0" + "@ethersproject/rlp" "5.7.0" + "@ethersproject/sha2" "5.7.0" + "@ethersproject/signing-key" "5.7.0" + "@ethersproject/solidity" "5.7.0" + "@ethersproject/strings" "5.7.0" + "@ethersproject/transactions" "5.7.0" + "@ethersproject/units" "5.7.0" + "@ethersproject/wallet" "5.7.0" + "@ethersproject/web" "5.7.1" + "@ethersproject/wordlists" "5.7.0" + +event-emitter@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== + dependencies: + d "1" + es5-ext "~0.10.14" + +eventemitter3@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" + integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== + +events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + +ext@^1.1.2: + version "1.7.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.7.0.tgz#0ea4383c0103d60e70be99e9a7f11027a33c4f5f" + integrity sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw== + dependencies: + type "^2.7.2" + +eyes@^0.1.8: + version "0.1.8" + resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" + integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== + +fast-redact@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.3.0.tgz#7c83ce3a7be4898241a46560d51de10f653f7634" + integrity sha512-6T5V1QK1u4oF+ATxs1lWUmlEk6P2T9HqJG3e2DnHOdVgZy2rFJBoEnrIedcTXlkAHU/zKC+7KETJ+KGGKwxgMQ== + +fast-safe-stringify@^2.0.6: + version "2.1.1" + resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" + integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== + +fast-stable-stringify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz#5c5543462b22aeeefd36d05b34e51c78cb86d313" + integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag== + +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + +filter-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" + integrity sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ== + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg== + dependencies: + locate-path "^3.0.0" + +find-up@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + +events@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" + integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== + font-awesome@^4.7.0: version "4.7.0" resolved "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz" integrity sha512-U6kGnykA/6bFmg1M/oT9EkFeIYv7JlX3bozwQJWiiLz6L0w3F5vBVPxHlwyX/vtNq1ckcpRKOB9f2Qal/VtFpg== +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +get-caller-file@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.3: + version "1.2.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" + integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-proto "^1.0.1" + has-symbols "^1.0.3" + get-nonce@^1.0.0: version "1.0.1" resolved "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz" @@ -799,12 +3073,58 @@ gif-picker-react@^1.1.0: resolved "https://registry.npmjs.org/gif-picker-react/-/gif-picker-react-1.3.0.tgz" integrity sha512-IYDmx9iEouC84JCrOt/HSaiRgHD8o7/catZCspUVpNEXoIunq7CF65JcmyTyoPkVJZcQz0ofjU5Gp5C2bqwOlQ== +global-tld-list@^0.0.1139: + version "0.0.1139" + resolved "https://registry.yarnpkg.com/global-tld-list/-/global-tld-list-0.0.1139.tgz#70400a3f3ccac1a19a8184274a1b117bc8a27969" + integrity sha512-TCWjAwHPzFV6zbQ5jnJvJTctesHGJr9BppxivRuIxTiIFUzaxy1F0674cxjoJecW5s8V32Q5i35dBFqvAy7eGQ== + +globalyzer@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/globalyzer/-/globalyzer-0.1.0.tgz#cb76da79555669a1519d5a8edf093afaa0bf1465" + integrity sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q== + +globrex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/globrex/-/globrex-0.1.2.tgz#dd5d9ec826232730cd6793a5e33a9302985e6098" + integrity sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg== + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + graceful-fs@^4.2.4: version "4.2.11" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + +has-symbols@^1.0.2, has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: version "1.1.7" resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz" integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== @@ -812,6 +3132,11 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hey-listen@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/hey-listen/-/hey-listen-1.0.8.tgz#8e59561ff724908de1aa924ed6ecc84a56a9aa68" + integrity sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q== + hls.js@^1.4.9: version "1.4.10" resolved "https://registry.npmjs.org/hls.js/-/hls.js-1.4.10.tgz" @@ -854,7 +3179,19 @@ htmlparser2@7.2.0: domutils "^2.8.0" entities "^3.0.1" -inherits@^2.0.3, inherits@^2.0.4: +humanize-ms@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== + dependencies: + ms "^2.0.0" + +ieee754@^1.1.13, ieee754@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.4: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -864,6 +3201,16 @@ inline-style-parser@0.1.1: resolved "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz" integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== +intl-messageformat@^9.13.0: + version "9.13.0" + resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-9.13.0.tgz#97360b73bd82212e4f6005c712a4a16053165468" + integrity sha512-7sGC7QnSQGa5LZP7bXLDhVDtQOeKGeBFGHF2Y8LVBwYZoQZCgWeKoPGTa5GMG8g/TzDgeXuYJQis7Ggiw2xTOw== + dependencies: + "@formatjs/ecma402-abstract" "1.11.4" + "@formatjs/fast-memoize" "1.2.1" + "@formatjs/icu-messageformat-parser" "2.1.0" + tslib "^2.1.0" + invariant@^2.2.4: version "2.2.4" resolved "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz" @@ -871,11 +3218,97 @@ invariant@^2.2.4: dependencies: loose-envify "^1.0.0" +is-arguments@^1.0.4: + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" + integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-callable@^1.1.3: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-generator-function@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" + integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== + dependencies: + has-tostringtag "^1.0.0" + +is-promise@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" + integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-typed-array@^1.1.3: + version "1.1.12" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== + dependencies: + which-typed-array "^1.1.11" + +is-typedarray@1.0.0, is-typedarray@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" + integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== + +isarray@^2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + +isomorphic-ws@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" + integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== + +jayson@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.1.0.tgz#60dc946a85197317f2b1439d672a8b0a99cea2f9" + integrity sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A== + dependencies: + "@types/connect" "^3.4.33" + "@types/node" "^12.12.54" + "@types/ws" "^7.4.4" + JSONStream "^1.3.5" + commander "^2.20.3" + delay "^5.0.0" + es6-promisify "^5.0.0" + eyes "^0.1.8" + isomorphic-ws "^4.0.1" + json-stringify-safe "^5.0.1" + uuid "^8.3.2" + ws "^7.4.5" + +joi@17.9.1: + version "17.9.1" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.9.1.tgz#74899b9fa3646904afa984a11df648eca66c9018" + integrity sha512-FariIi9j6QODKATGBrEX7HZcja8Bsh3rfdGYy/Sb65sGlZWK/QWesU1ghk7aJWDj95knjXlQfSmzFSPPkLVsfw== + dependencies: + "@hapi/hoek" "^9.0.0" + "@hapi/topo" "^5.0.0" + "@sideway/address" "^4.1.3" + "@sideway/formula" "^3.0.1" + "@sideway/pinpoint" "^2.0.0" + js-base64@^3.7.2: version "3.7.5" resolved "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz" @@ -891,6 +3324,81 @@ js-sha3@0.8.0: resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +livekit-client@^1.13.3: + version "1.13.4" + resolved "https://registry.yarnpkg.com/livekit-client/-/livekit-client-1.13.4.tgz#af20a338334d6c9e3c81e7c9641222d95a532b75" + integrity sha512-7Ef80q7aWkgkFWfWBd+gv2AcUrubpt+oXYk+tXSWVkTXoPpm6xqrMPu3TNYKIzXQWt8IEbyPQLLVsCZpR7RBTg== + dependencies: + "@bufbuild/protobuf" "^1.3.0" + events "^3.3.0" + loglevel "^1.8.0" + sdp-transform "^2.14.1" + ts-debounce "^4.0.0" + typed-emitter "^2.1.0" + webrtc-adapter "^8.1.1" + +json-rpc-engine@6.1.0, json-rpc-engine@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/json-rpc-engine/-/json-rpc-engine-6.1.0.tgz#bf5ff7d029e1c1bf20cb6c0e9f348dcd8be5a393" + integrity sha512-NEdLrtrq1jUZyfjkr9OCz9EzCNhnRyWtt1PAnvnhwy6e8XETS0Dtc+ZNCO2gvuAoKsIn2+vCSowXTYE4CkgnAQ== + dependencies: + "@metamask/safe-event-emitter" "^2.0.0" + eth-rpc-errors "^4.0.2" + +json-rpc-random-id@^1.0.0, json-rpc-random-id@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-rpc-random-id/-/json-rpc-random-id-1.0.1.tgz#ba49d96aded1444dbb8da3d203748acbbcdec8c8" + integrity sha512-RJ9YYNCkhVDBuP4zN5BBtYAzEl03yq/jIIsyif0JY9qyJuQQZNeDK7anAPKKlyEtLSj2s8h6hNh2F8zO5q7ScA== + +json-stringify-safe@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + +jsonparse@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" + integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== + +keccak@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" + integrity sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q== + dependencies: + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" + +keyvaluestorage-interface@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz#13ebdf71f5284ad54be94bd1ad9ed79adad515ff" + integrity sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g== + +lit-element@^3.3.0: + version "3.3.3" + resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.3.3.tgz#10bc19702b96ef5416cf7a70177255bfb17b3209" + integrity sha512-XbeRxmTHubXENkV4h8RIPyr8lXc+Ff28rkcQzw3G6up2xg5E8Zu1IgOWIwBLEQsu3cOVFqdYwiVi0hv0SlpqUA== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.1.0" + "@lit/reactive-element" "^1.3.0" + lit-html "^2.8.0" + +lit-html@^2.7.0, lit-html@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.8.0.tgz#96456a4bb4ee717b9a7d2f94562a16509d39bffa" + integrity sha512-o9t+MQM3P4y7M7yNzqAyjp7z+mQGa4NS4CxiyLqFPyFWyc4O+nodLrkrxSaCTrla6M5YOLaT3RpbbqjszB5g3Q== + dependencies: + "@types/trusted-types" "^2.0.2" + +lit@2.7.6: + version "2.7.6" + resolved "https://registry.yarnpkg.com/lit/-/lit-2.7.6.tgz#810007b876ed43e0c70124de91831921598b1665" + integrity sha512-1amFHA7t4VaaDe+vdQejSVBklwtH9svGoG6/dZi9JhxtJBBlqY5D1RV7iLUYY0trCqQc4NfhYYZilZiVHt7Hxg== + dependencies: + "@lit/reactive-element" "^1.6.0" + lit-element "^3.3.0" + lit-html "^2.7.0" + livepeer@2.8.0: version "2.8.0" resolved "https://registry.npmjs.org/livepeer/-/livepeer-2.8.0.tgz" @@ -905,6 +3413,21 @@ livepeer@2.8.0: tus-js-client "^3.1.0" zustand "^4.3.9" +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A== + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" + +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + lodash._baseiteratee@~4.7.0: version "4.7.0" resolved "https://registry.npmjs.org/lodash._baseiteratee/-/lodash._baseiteratee-4.7.0.tgz" @@ -942,6 +3465,26 @@ lodash._stringtopath@~4.8.0: dependencies: lodash._basetostring "~4.12.0" +lodash.defaults@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" + integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== + +lodash.isequal@4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.partition@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/lodash.partition/-/lodash.partition-4.6.0.tgz#a38e46b73469e0420b0da1212e66d414be364ba4" + integrity sha512-35L3dSF3Q6V1w5j6V3NhNlQjzsRDC/pYKCTdYTmwqSib+Q8ponkAmt/PwEOq3EmI38DSCl+SkIVwLd+uSlVdrg== + lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz" @@ -955,6 +3498,16 @@ lodash.uniqby@4.5.0: lodash._baseiteratee "~4.7.0" lodash._baseuniq "~4.6.0" +loglevel@^1.8.0, loglevel@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.8.1.tgz#5c621f83d5b48c54ae93b6156353f555963377b4" + integrity sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg== + +lodash.uniqby@^4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz#d99c07a669e9e6d24e1362dfe266c67616af1302" + integrity sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww== + loose-envify@^1.0.0: version "1.4.0" resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz" @@ -962,6 +3515,34 @@ loose-envify@^1.0.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +lru-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" + integrity sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ== + dependencies: + es5-ext "~0.10.2" + +memoizee@^0.4.15: + version "0.4.15" + resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" + integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== + dependencies: + d "^1.0.1" + es5-ext "^0.10.53" + es6-weak-map "^2.0.3" + event-emitter "^0.3.5" + is-promise "^2.2.2" + lru-queue "^0.1.0" + next-tick "^1.1.0" + timers-ext "^0.1.7" + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz" @@ -977,21 +3558,63 @@ moment@^2.29.4: resolved "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== +motion@10.16.2: + version "10.16.2" + resolved "https://registry.yarnpkg.com/motion/-/motion-10.16.2.tgz#7dc173c6ad62210a7e9916caeeaf22c51e598d21" + integrity sha512-p+PurYqfUdcJZvtnmAqu5fJgV2kR0uLFQuBKtLeFVTrYEVllI99tiOTSefVNYuip9ELTEkepIIDftNdze76NAQ== + dependencies: + "@motionone/animation" "^10.15.1" + "@motionone/dom" "^10.16.2" + "@motionone/svelte" "^10.16.2" + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + "@motionone/vue" "^10.16.2" + +mri@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + ms@2.1.2: version "2.1.2" resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.0.0: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + ms@^3.0.0-canary.1: version "3.0.0-canary.1" resolved "https://registry.npmjs.org/ms/-/ms-3.0.0-canary.1.tgz" integrity sha512-kh8ARjh8rMN7Du2igDRO9QJnqCb2xYTJxyQYK7vJJS4TvLLmsbyhiKpSW+t+y26gyOyMd0riphX0GeWKU3ky5g== -multiformats@9.9.0: +multiformats@9.9.0, multiformats@^9.4.2: version "9.9.0" resolved "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz" integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg== +nanoid@^3.3.1: + version "3.3.6" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" + integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== + +nanoid@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-4.0.2.tgz#140b3c5003959adbebf521c170f282c5e7f9fb9e" + integrity sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw== + +next-tick@1, next-tick@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" + integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== + +node-addon-api@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" + integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== + node-fetch@^2.6.12: version "2.6.12" resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz" @@ -999,6 +3622,129 @@ node-fetch@^2.6.12: dependencies: whatwg-url "^5.0.0" +node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: + version "4.6.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" + integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== + +object-inspect@^1.9.0: + version "1.12.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.3.tgz#ba62dffd67ee256c8c086dfae69e016cd1f198b9" + integrity sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g== + +on-exit-leak-free@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz#b39c9e3bf7690d890f4861558b0d7b90a442d209" + integrity sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg== + +once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +p-limit@^2.0.0, p-limit@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ== + dependencies: + p-limit "^2.0.0" + +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + +p-try@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + integrity sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ== + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== + +pify@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" + integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== + +pino-abstract-transport@v0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz#4b54348d8f73713bfd14e3dc44228739aa13d9c0" + integrity sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ== + dependencies: + duplexify "^4.1.2" + split2 "^4.0.0" + +pino-std-serializers@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" + integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== + +pino@7.11.0: + version "7.11.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-7.11.0.tgz#0f0ea5c4683dc91388081d44bff10c83125066f6" + integrity sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.0.0" + on-exit-leak-free "^0.2.0" + pino-abstract-transport v0.5.0 + pino-std-serializers "^4.0.0" + process-warning "^1.0.0" + quick-format-unescaped "^4.0.3" + real-require "^0.1.0" + safe-stable-stringify "^2.1.0" + sonic-boom "^2.2.1" + thread-stream "^0.15.1" + +pngjs@^3.3.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" + integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== + +pngjs@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-5.0.0.tgz#e79dd2b215767fd9c04561c01236df960bce7fbb" + integrity sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw== + +preact@10.4.1: + version "10.4.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.4.1.tgz#9b3ba020547673a231c6cf16f0fbaef0e8863431" + integrity sha512-WKrRpCSwL2t3tpOOGhf2WfTpcmbpxaWtDbdJdKdjd0aEiTkvOmS4NBkG6kzlaAHI9AkQ3iVqbFWM3Ei7mZ4o1Q== + +preact@^10.5.9: + version "10.17.1" + resolved "https://registry.yarnpkg.com/preact/-/preact-10.17.1.tgz#0a1b3c658c019e759326b9648c62912cf5c2dde1" + integrity sha512-X9BODrvQ4Ekwv9GURm9AKAGaomqXmip7NQTZgY7gcNmr7XE83adOMJvd3N42id1tMFU7ojiynRsYnY6/BRFxLA== + +process-warning@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" + integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== + proper-lockfile@^4.1.2: version "4.1.2" resolved "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz" @@ -1008,11 +3754,77 @@ proper-lockfile@^4.1.2: retry "^0.12.0" signal-exit "^3.0.2" +proxy-compare@2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/proxy-compare/-/proxy-compare-2.5.1.tgz#17818e33d1653fbac8c2ec31406bce8a2966f600" + integrity sha512-oyfc0Tx87Cpwva5ZXezSp5V9vht1c7dZBhvuV/y3ctkgMVUmiAGDVeeB0dKhGSyT0v1ZTEQYpe/RXlBVBNuCLA== + +qrcode@1.4.4: + version "1.4.4" + resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.4.4.tgz#f0c43568a7e7510a55efc3b88d9602f71963ea83" + integrity sha512-oLzEC5+NKFou9P0bMj5+v6Z40evexeE29Z9cummZXZ9QXyMr3lphkURzxjXgPJC5azpxcshoDWV1xE46z+/c3Q== + dependencies: + buffer "^5.4.3" + buffer-alloc "^1.2.0" + buffer-from "^1.1.1" + dijkstrajs "^1.0.1" + isarray "^2.0.1" + pngjs "^3.3.0" + yargs "^13.2.4" + +qrcode@1.5.3: + version "1.5.3" + resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.5.3.tgz#03afa80912c0dccf12bc93f615a535aad1066170" + integrity sha512-puyri6ApkEHYiVl4CFzo1tDkAZ+ATcnbJrJ6RiBM1Fhctdn/ix9MTE3hRph33omisEbC/2fcfemsseiKgBPKZg== + dependencies: + dijkstrajs "^1.0.1" + encode-utf8 "^1.0.3" + pngjs "^5.0.0" + yargs "^15.3.1" + +qs@^6.10.3: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + +query-string@6.13.5: + version "6.13.5" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.5.tgz#99e95e2fb7021db90a6f373f990c0c814b3812d8" + integrity sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q== + dependencies: + decode-uri-component "^0.2.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + +query-string@7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/query-string/-/query-string-7.1.3.tgz#a1cf90e994abb113a325804a972d98276fe02328" + integrity sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg== + dependencies: + decode-uri-component "^0.2.2" + filter-obj "^1.1.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + querystringify@^2.1.1: version "2.2.0" resolved "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz" integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== +quick-format-unescaped@^4.0.3: + version "4.0.4" + resolved "https://registry.yarnpkg.com/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz#93ef6dd8d3453cbc7970dd614fad4c5954d6b5a7" + integrity sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg== + +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + react-icons@^4.10.1: version "4.10.1" resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.10.1.tgz#3f3b5eec1f63c1796f6a26174a1091ca6437a500" @@ -1065,11 +3877,40 @@ react-twitter-embed@^4.0.4: dependencies: scriptjs "^2.5.9" +readable-stream@^3.1.1, readable-stream@^3.5.0, readable-stream@^3.6.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +real-require@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.1.0.tgz#736ac214caa20632847b7ca8c1056a0767df9381" + integrity sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg== + regenerator-runtime@^0.13.11: version "0.13.11" resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + +require-main-filename@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" + integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" @@ -1080,11 +3921,104 @@ retry@^0.12.0: resolved "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz" integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== +rpc-websockets@^7.5.1: + version "7.6.0" + resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.6.0.tgz#d3f4c0dac108ca35566b0e31552c32e58928cd04" + integrity sha512-Jgcs8q6t8Go98dEulww1x7RysgTkzpCMelVxZW4hvuyFtOGpeUz9prpr2KjUa/usqxgFCd9Tu3+yhHEP9GVmiQ== + dependencies: + "@babel/runtime" "^7.17.2" + eventemitter3 "^4.0.7" + uuid "^8.3.2" + ws "^8.5.0" + optionalDependencies: + bufferutil "^4.0.1" + utf-8-validate "^5.0.2" + +rxjs@^6.6.3: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + +rxjs@^7.5.2, rxjs@^7.5.5, rxjs@^7.8.0: + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== + dependencies: + tslib "^2.1.0" + +sade@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.8.1.tgz#0a78e81d658d394887be57d2a409bf703a3b2701" + integrity sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A== + dependencies: + mri "^1.1.0" + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-json-utils@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/safe-json-utils/-/safe-json-utils-1.1.1.tgz#0e883874467d95ab914c3f511096b89bfb3e63b1" + integrity sha512-SAJWGKDs50tAbiDXLf89PDwt9XYkWyANFWVzn4dTXl5QyI8t2o/bW5/OJl3lvc2WVU4MEpTo9Yz5NVFNsp+OJQ== + +safe-stable-stringify@^2.1.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" + integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== + scriptjs@^2.5.9: version "2.5.9" resolved "https://registry.npmjs.org/scriptjs/-/scriptjs-2.5.9.tgz" integrity sha512-qGVDoreyYiP1pkQnbnFAUIS5AjenNwwQBdl7zeos9etl+hYKWahjRTfzAZZYBv5xNHx7vNKCmaLDQZ6Fr2AEXg== +sdp-transform@^2.14.1: + version "2.14.1" + resolved "https://registry.yarnpkg.com/sdp-transform/-/sdp-transform-2.14.1.tgz#2bb443583d478dee217df4caa284c46b870d5827" + integrity sha512-RjZyX3nVwJyCuTo5tGPx+PZWkDMCg7oOLpSlhjDdZfwUoNqG1mM8nyj31IGHyaPWXhjbP7cdK3qZ2bmkJ1GzRw== + +sdp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/sdp/-/sdp-3.2.0.tgz#8961420552b36663b4d13ddba6f478d1461896a5" + integrity sha512-d7wDPgDV3DDiqulJjKiV2865wKsJ34YI+NDREbm+FySq6WuKOikwyNQcm+doLAZ1O6ltdO0SeKle2xMpN3Brgw== + +scrypt-js@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" + integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== + +semver@^7.3.8: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + +set-blocking@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== + +sha.js@^2.4.11: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + signal-exit@^3.0.2: version "3.0.7" resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" @@ -1108,6 +4042,87 @@ socket.io-parser@~4.2.1: "@socket.io/component-emitter" "~3.1.0" debug "~4.3.1" +sonic-boom@^2.2.1: + version "2.8.0" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-2.8.0.tgz#c1def62a77425090e6ad7516aad8eb402e047611" + integrity sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg== + dependencies: + atomic-sleep "^1.0.0" + +split-on-first@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" + integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== + +split2@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + +stream-browserify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-3.0.0.tgz#22b0a2850cdf6503e73085da1fc7b7d0c2122f2f" + integrity sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA== + dependencies: + inherits "~2.0.4" + readable-stream "^3.5.0" + +stream-shift@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" + integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== + +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== + +string-width@^3.0.0, string-width@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" + integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== + dependencies: + emoji-regex "^7.0.1" + is-fullwidth-code-point "^2.0.0" + strip-ansi "^5.1.0" + +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" + integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== + dependencies: + ansi-regex "^4.1.0" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +sturdy-websocket@^0.1.12: + version "0.1.12" + resolved "https://registry.yarnpkg.com/sturdy-websocket/-/sturdy-websocket-0.1.12.tgz#84bb779f948b585a695f76961dc7d1c4a5e87629" + integrity sha512-PA7h8LdjaMoIlC5HAwLVzae4raGWgyroscV4oUpEiTtEFINcNa47/CKYT3e98o+FfsJgrclI2pYpaJrz0aaoew== + dependencies: + lodash.defaults "^4.2.0" + style-to-js@1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.1.tgz" @@ -1122,21 +4137,102 @@ style-to-object@0.3.0: dependencies: inline-style-parser "0.1.1" +superstruct@^0.14.2: + version "0.14.2" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.14.2.tgz#0dbcdf3d83676588828f1cf5ed35cda02f59025b" + integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ== + +superstruct@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" + integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== + +svelte-i18n@^3.3.13: + version "3.7.4" + resolved "https://registry.yarnpkg.com/svelte-i18n/-/svelte-i18n-3.7.4.tgz#6cf2c86075fd748bd8ca2de5762e43a596c7d189" + integrity sha512-yGRCNo+eBT4cPuU7IVsYTYjxB7I2V8qgUZPlHnNctJj5IgbJgV78flsRzpjZ/8iUYZrS49oCt7uxlU3AZv/N5Q== + dependencies: + cli-color "^2.0.3" + deepmerge "^4.2.2" + esbuild "^0.19.2" + estree-walker "^2" + intl-messageformat "^9.13.0" + sade "^1.8.1" + tiny-glob "^0.2.9" + +svelte@^3.49.0: + version "3.59.2" + resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.59.2.tgz#a137b28e025a181292b2ae2e3dca90bf8ec73aec" + integrity sha512-vzSyuGr3eEoAtT/A6bmajosJZIUWySzY2CzB3w2pgPvnkUjGqlDnsNnA0PMO+mMAhuyMul6C2uuZzY6ELSkzyA== + +text-encoding-utf-8@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13" + integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg== + +thread-stream@^0.15.1: + version "0.15.2" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-0.15.2.tgz#fb95ad87d2f1e28f07116eb23d85aba3bc0425f4" + integrity sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA== + dependencies: + real-require "^0.1.0" + +"through@>=2.2.7 <3": + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== + +timers-ext@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" + integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== + dependencies: + es5-ext "~0.10.46" + next-tick "1" + +tiny-glob@^0.2.9: + version "0.2.9" + resolved "https://registry.yarnpkg.com/tiny-glob/-/tiny-glob-0.2.9.tgz#2212d441ac17928033b110f8b3640683129d31e2" + integrity sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg== + dependencies: + globalyzer "0.1.0" + globrex "^0.1.2" + tiny-warning@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== + tr46@~0.0.3: version "0.0.3" resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== +ts-debounce@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/ts-debounce/-/ts-debounce-4.0.0.tgz#33440ef64fab53793c3d546a8ca6ae539ec15841" + integrity sha512-+1iDGY6NmOGidq7i7xZGA4cm8DAa6fqdYcvO5Z6yBevH++Bdo9Qt/mN0TzHUgcCcKv1gmh9+W5dHqz8pMWbCbg== + +tslib@1.14.1, tslib@^1.9.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + tslib@^2.0.0, tslib@^2.1.0, tslib@^2.3.0: version "2.5.0" resolved "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== +tslib@^2.3.1: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + tus-js-client@^3.1.0: version "3.1.1" resolved "https://registry.npmjs.org/tus-js-client/-/tus-js-client-3.1.1.tgz" @@ -1150,6 +4246,37 @@ tus-js-client@^3.1.0: proper-lockfile "^4.1.2" url-parse "^1.5.7" +typed-emitter@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/typed-emitter/-/typed-emitter-2.1.0.tgz#ca78e3d8ef1476f228f548d62e04e3d4d3fd77fb" + integrity sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA== + optionalDependencies: + rxjs "^7.5.2" + +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" + integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== + +typedarray-to-buffer@3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + +uint8arrays@^3.0.0, uint8arrays@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" + integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== + dependencies: + multiformats "^9.4.2" + url-parse@^1.5.7: version "1.5.10" resolved "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz" @@ -1173,16 +4300,74 @@ use-sidecar@^1.1.2: detect-node-es "^1.1.0" tslib "^2.0.0" +use-sync-external-store@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.0.0.tgz#d98f4a9c2e73d0f958e7e2d2c2bfb5f618cbd8fd" + integrity sha512-AFVsxg5GkFg8GDcxnl+Z0lMAz9rE8DGJCc28qnBuQF7lac57B5smLcT37aXpXIIPz75rW4g3eXHPjhHwdGskOw== + use-sync-external-store@1.2.0, use-sync-external-store@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== +usehooks-ts@^2.9.1: + version "2.9.1" + resolved "https://registry.yarnpkg.com/usehooks-ts/-/usehooks-ts-2.9.1.tgz#953d3284851ffd097432379e271ce046a8180b37" + integrity sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA== + +uuid@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + +utf-8-validate@^5.0.2: + version "5.0.10" + resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2" + integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== + dependencies: + node-gyp-build "^4.3.0" + +util-deprecate@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +util@^0.12.4: + version "0.12.5" + resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" + integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== + dependencies: + inherits "^2.0.3" + is-arguments "^1.0.4" + is-generator-function "^1.0.7" + is-typed-array "^1.1.3" + which-typed-array "^1.1.2" + +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + +valtio@1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/valtio/-/valtio-1.11.0.tgz#c029dcd17a0f99d2fbec933721fe64cfd32a31ed" + integrity sha512-65Yd0yU5qs86b5lN1eu/nzcTgQ9/6YnD6iO+DDaDbQLn1Zv2w12Gwk43WkPlUBxk5wL/6cD5YMFf7kj6HZ1Kpg== + dependencies: + proxy-compare "2.5.1" + use-sync-external-store "1.2.0" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +webrtc-adapter@^8.1.1: + version "8.2.3" + resolved "https://registry.yarnpkg.com/webrtc-adapter/-/webrtc-adapter-8.2.3.tgz#85e5e52ea68e808be8d6db85e338aa5c95e80022" + integrity sha512-gnmRz++suzmvxtp3ehQts6s2JtAGPuDPjA1F3a9ckNpG1kYdYuHWYpazoAnL9FS5/B21tKlhkorbdCXat0+4xQ== + dependencies: + sdp "^3.2.0" + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" @@ -1191,6 +4376,65 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +which-module@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.1.tgz#776b1fe35d90aebe99e8ac15eb24093389a4a409" + integrity sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ== + +which-typed-array@^1.1.11, which-typed-array@^1.1.2: + version "1.1.11" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.11.tgz#99d691f23c72aab6768680805a271b69761ed61a" + integrity sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + +wrap-ansi@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" + integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== + dependencies: + ansi-styles "^3.2.0" + string-width "^3.0.0" + strip-ansi "^5.0.0" + +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +ws@7.4.6: + version "7.4.6" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" + integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== + +ws@7.5.3: + version "7.5.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74" + integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg== + +ws@^7.4.5, ws@^7.5.1: + version "7.5.9" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" + integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== + +ws@^8.5.0: + version "8.14.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" + integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== + ws@~8.11.0: version "8.11.0" resolved "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz" @@ -1201,6 +4445,70 @@ xmlhttprequest-ssl@~2.0.0: resolved "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz" integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A== +xtend@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== + +y18n@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" + integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yargs-parser@^13.1.2: + version "13.1.2" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" + integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs@^13.2.4: + version "13.3.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" + integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== + dependencies: + cliui "^5.0.0" + find-up "^3.0.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^3.0.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^13.1.2" + +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + zustand@^4.3.9: version "4.4.0" resolved "https://registry.npmjs.org/zustand/-/zustand-4.4.0.tgz" diff --git a/yarn.lock b/yarn.lock index bc45eb097..14420088a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14967,16 +14967,16 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== +typescript@5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.2.tgz#891e1a90c5189d8506af64b9ef929fca99ba1ee5" + integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw== + typescript@^4.6.4: version "4.8.4" resolved "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz" integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== -typescript@~4.6.2: - version "4.6.4" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz" - integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== - ua-parser-js@^0.7.30: version "0.7.31" resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz"