From 9dc940b9d8949676a1f343139b1e689b554730e6 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 18 Mar 2024 16:30:34 -0500 Subject: [PATCH] Reorganize dependencies --- apps/react/package.json | 1 + package.json | 1 - packages/react-sdk/package.json | 20 +++++++++------- packages/react-sdk/src/hooks/useClient.ts | 5 ++-- .../src/hooks/useStreamConsentList.ts | 8 +++---- yarn.lock | 24 ++++++++++++++++--- 6 files changed, 39 insertions(+), 20 deletions(-) diff --git a/apps/react/package.json b/apps/react/package.json index 183ca5be..4ce94e2c 100644 --- a/apps/react/package.json +++ b/apps/react/package.json @@ -24,6 +24,7 @@ "@xmtp/content-type-remote-attachment": "^1.1.8", "@xmtp/content-type-reply": "^1.1.9", "@xmtp/react-sdk": "workspace:*", + "@xmtp/xmtp-js": "^11.5.0", "date-fns": "^3.4.0", "react": "^18.2.0", "react-18-blockies": "^1.0.6", diff --git a/package.json b/package.json index 614c2e9b..d995c7b6 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "typecheck": "FORCE_COLOR=1 turbo run typecheck" }, "resolutions": { - "@xmtp/xmtp-js": "^11.4.1", "viem": "2.7.15" }, "dependencies": { diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json index 4ebb15c5..28e5f4de 100644 --- a/packages/react-sdk/package.json +++ b/packages/react-sdk/package.json @@ -70,17 +70,11 @@ ] }, "dependencies": { - "@xmtp/content-type-reaction": "^1.1.7", - "@xmtp/content-type-remote-attachment": "^1.1.8", - "@xmtp/content-type-reply": "^1.1.9", - "@xmtp/xmtp-js": "^11.5.0", "async-mutex": "^0.5.0", "date-fns": "^3.4.0", "dexie": "^3.2.6", "dexie-react-hooks": "^1.1.7", - "react": "^18.2.0", "uuid": "^9.0.1", - "viem": "^2.7.15", "zod": "^3.22.4" }, "devDependencies": { @@ -93,26 +87,34 @@ "@types/uuid": "^9.0.8", "@vitejs/plugin-react": "^4.2.1", "@vitest/coverage-v8": "^1.3.1", + "@xmtp/content-type-reaction": "^1.1.7", + "@xmtp/content-type-remote-attachment": "^1.1.8", + "@xmtp/content-type-reply": "^1.1.9", "@xmtp/tsconfig": "workspace:*", + "@xmtp/xmtp-js": "^11.5.0", "eslint": "^8.57.0", "eslint-config-xmtp-web": "workspace:*", "fake-indexeddb": "^5.0.2", "happy-dom": "^13.8.2", "prettier": "^3.2.5", - "react-dom": "^18.2.0", + "react": "^18.2.0", "rollup": "^4.13.0", "rollup-plugin-dts": "^6.1.0", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-tsconfig-paths": "^1.5.2", "typedoc": "^0.25.12", "typescript": "^5.4.2", + "viem": "^2.7.15", "vite": "^5.1.6", "vite-tsconfig-paths": "^4.3.1", "vitest": "^1.3.1" }, "peerDependencies": { - "@xmtp/xmtp-js": "^11.4.1", - "react": ">=16.14" + "@xmtp/content-type-reaction": "^1.1.7", + "@xmtp/content-type-remote-attachment": "^1.1.8", + "@xmtp/content-type-reply": "^1.1.9", + "@xmtp/xmtp-js": "^11.5.0", + "react": "^16.14.0 || ^17 || ^18" }, "engines": { "node": ">=18" diff --git a/packages/react-sdk/src/hooks/useClient.ts b/packages/react-sdk/src/hooks/useClient.ts index b85dbb98..45900373 100644 --- a/packages/react-sdk/src/hooks/useClient.ts +++ b/packages/react-sdk/src/hooks/useClient.ts @@ -1,7 +1,6 @@ import { useCallback, useContext, useRef, useState } from "react"; -import type { ClientOptions, Signer } from "@xmtp/xmtp-js"; +import type { ClientOptions } from "@xmtp/xmtp-js"; import { Client } from "@xmtp/xmtp-js"; -import type { WalletClient } from "viem"; import { XMTPContext } from "../contexts/XMTPContext"; import type { OnError } from "@/sharedTypes"; import { processUnprocessedMessages } from "@/helpers/caching/messages"; @@ -21,7 +20,7 @@ export type InitializeClientOptions = { /** * The signer (wallet) to associate with the XMTP client */ - signer?: Signer | WalletClient | null; + signer?: Parameters[0]; }; /** diff --git a/packages/react-sdk/src/hooks/useStreamConsentList.ts b/packages/react-sdk/src/hooks/useStreamConsentList.ts index 12a8eba1..951e714a 100644 --- a/packages/react-sdk/src/hooks/useStreamConsentList.ts +++ b/packages/react-sdk/src/hooks/useStreamConsentList.ts @@ -67,11 +67,11 @@ export const useStreamConsentList = ( for await (const action of await stream) { // update the local DB, but don't publish to the network - if (action.allow) { - void allow(action.allow.walletAddresses, true); + if (action.allowAddress) { + void allow(action.allowAddress.walletAddresses, true); } - if (action.block) { - void deny(action.block.walletAddresses, true); + if (action.denyAddress) { + void deny(action.denyAddress.walletAddresses, true); } void onAction?.(action); } diff --git a/yarn.lock b/yarn.lock index 140d9b0f..66093ae9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5508,6 +5508,7 @@ __metadata: "@xmtp/content-type-reply": "npm:^1.1.9" "@xmtp/react-sdk": "workspace:*" "@xmtp/tsconfig": "workspace:*" + "@xmtp/xmtp-js": "npm:^11.5.0" date-fns: "npm:^3.4.0" eslint: "npm:^8.57.0" eslint-config-xmtp-web: "workspace:*" @@ -5549,7 +5550,6 @@ __metadata: happy-dom: "npm:^13.8.2" prettier: "npm:^3.2.5" react: "npm:^18.2.0" - react-dom: "npm:^18.2.0" rollup: "npm:^4.13.0" rollup-plugin-dts: "npm:^6.1.0" rollup-plugin-filesize: "npm:^10.0.0" @@ -5563,8 +5563,11 @@ __metadata: vitest: "npm:^1.3.1" zod: "npm:^3.22.4" peerDependencies: - "@xmtp/xmtp-js": ^11.4.1 - react: ">=16.14" + "@xmtp/content-type-reaction": ^1.1.7 + "@xmtp/content-type-remote-attachment": ^1.1.8 + "@xmtp/content-type-reply": ^1.1.9 + "@xmtp/xmtp-js": ^11.5.0 + react: ^16.14.0 || ^17 || ^18 languageName: unknown linkType: soft @@ -5646,6 +5649,21 @@ __metadata: languageName: node linkType: hard +"@xmtp/xmtp-js@npm:^11.3.12, @xmtp/xmtp-js@npm:^11.5.0": + version: 11.5.0 + resolution: "@xmtp/xmtp-js@npm:11.5.0" + dependencies: + "@noble/secp256k1": "npm:1.7.1" + "@xmtp/proto": "npm:3.45.0" + "@xmtp/user-preferences-bindings-wasm": "npm:^0.3.6" + async-mutex: "npm:^0.5.0" + elliptic: "npm:^6.5.4" + long: "npm:^5.2.3" + viem: "npm:2.7.15" + checksum: 10/767eab8fff15d3d7fdcecba7a08fad8650b8f2392c797a09429739a6730ca1daacdcbe2056bccb6a6e19a2f90b9adc73f0f199c5a9b7b348a29e9a9110db5108 + languageName: node + linkType: hard + "@xmtp/xmtp-js@npm:^11.4.1": version: 11.4.1 resolution: "@xmtp/xmtp-js@npm:11.4.1"