diff --git a/app/src/App.tsx b/app/src/App.tsx index 0367830..353a6c8 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -1,16 +1,3 @@ -//TODO: research into having signatures somehow? -//TODO research: **each message sent should not be able to be spoofed** -/** - * Reference: - * https://www.notion.so/Logos-Forum-PoC-Waku-Powered-Opchan-1968f96fb65c8078b343c43429d66d0a#1968f96fb65c8025a929c2c9255a57c4 - * Also note that for UX purposes, **we should not ask a user to sign with their Bitcoin wallet for every action.** - * - * Instead, a key delegation system should be developed. - * - * - User sign an in-browser key with their wallet and broadcast it - * - Browser uses in-browser key to sign messages moving forward - */ - import { Toaster } from '@/components/ui/toaster'; import { Toaster as Sonner } from '@/components/ui/sonner'; import { TooltipProvider } from '@/components/ui/tooltip'; diff --git a/package-lock.json b/package-lock.json index 337950b..ed0c92b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18008,7 +18008,7 @@ "name": "@opchan/react", "version": "1.0.0", "dependencies": { - "@opchan/core": "file:../core" + "@opchan/core": "^1.0.0" }, "devDependencies": { "@types/react": "^18.2.66", diff --git a/packages/core/package.json b/packages/core/package.json index 64e0b57..78f54f4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -16,6 +16,9 @@ "files": [ "dist" ], + "publishConfig": { + "access": "public" + }, "scripts": { "build": "npm run clean && npm run build:cjs && cp dist/cjs/index.js dist/index.js && npm run build:esm && npm run build:types", "build:cjs": "tsc --module commonjs --outDir dist/cjs", diff --git a/packages/core/src/lib/database/schema.ts b/packages/core/src/lib/database/schema.ts index e133610..77ee96c 100644 --- a/packages/core/src/lib/database/schema.ts +++ b/packages/core/src/lib/database/schema.ts @@ -1,5 +1,5 @@ export const DB_NAME = 'opchan-local'; -export const DB_VERSION = 3; +export const DB_VERSION = 4; export const STORE = { CELLS: 'cells', diff --git a/packages/react/README.md b/packages/react/README.md index 372e03d..4b64747 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -10,15 +10,16 @@ npm i @opchan/react @opchan/core react react-dom ### Quickstart +#### Basic Usage + ```tsx import React from 'react'; import { createRoot } from 'react-dom/client'; import { OpChanProvider } from '@opchan/react'; +import type { OpChanClientConfig } from '@opchan/core'; -const config = { - // See @opchan/core for full options - waku: { bootstrapPeers: [], pubsubTopic: 'opchan-v1' }, - database: { name: 'opchan' }, +const config: OpChanClientConfig = { + ordiscanApiKey: 'YOUR_ORDISCAN_API_KEY', }; // Optional: bridge your wallet to OpChan @@ -44,6 +45,37 @@ function App() { createRoot(document.getElementById('root')!).render(); ``` +#### (Suggested) With Reown AppKit Integration + +Using Reown AppKit for wallet management: + +```tsx +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import { WagmiProvider } from 'wagmi'; +import { AppKitProvider } from '@reown/appkit/react'; +import { OpchanWithAppKit } from './providers/OpchanWithAppKit'; + +// Define your own config for networks, or use our by default (supports Bitcoin and Ethereum) +import { config, appkitConfig } from '@opchan/core'; + +const opchanConfig = { ordiscanApiKey: 'YOUR_ORDISCAN_API_KEY' }; + +function App() { + return ( + + + + {/* your app */} + + + + ); +} + +createRoot(document.getElementById('root')!).render(); +``` + ### Common usage ```tsx @@ -107,6 +139,12 @@ export function Connect() { - `WalletAdapter`: - `getAccount(): WalletAdapterAccount | null` - `onChange(cb: (a: WalletAdapterAccount | null) => void): () => void` + - **`OpchanWithAppKit`**: Convenience wrapper around `OpChanProvider` that integrates with Reown AppKit. + - Props: + - `config: OpChanClientConfig` — core client configuration. + - `children: React.ReactNode`. + - Automatically bridges AppKit wallet connections to OpChan's wallet adapter interface. + - Requires `WagmiProvider` and `AppKitProvider` from Reown AppKit as parent providers. - **`ClientProvider`**: Low-level provider if you construct `OpChanClient` yourself. - Props: `{ client: OpChanClient; children: React.ReactNode }`. diff --git a/packages/react/package.json b/packages/react/package.json index 21db873..2e33ac6 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -17,6 +17,9 @@ "files": [ "dist" ], + "publishConfig": { + "access": "public" + }, "scripts": { "build": "npm run clean && npm run build:esm && npm run build:types", "build:esm": "tsc -b --force tsconfig.build.json && cp dist/index.js dist/index.esm.js", @@ -30,7 +33,7 @@ "react-dom": ">=18.0.0" }, "dependencies": { - "@opchan/core": "file:../core" + "@opchan/core": "^1.0.0" }, "devDependencies": { "typescript": "^5.5.3",