-
Notifications
You must be signed in to change notification settings - Fork 51
chore: add worktree setup scripts and AGENTS.md documentation #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0a0ca5f
chore: add worktree setup scripts and AGENTS.md documentation
ignaciosantise b0fa75f
Merge branch 'main' into chore/worktree-scripts-and-agents-docs
ignaciosantise 56587bf
fix: use node scripts for Expo projects to support Vercel builds
ignaciosantise fbbb705
fix: handle missing source files in copy-sample-files.js
ignaciosantise aa37366
revert: restore original scripts for pos-app and poc-pos-app
ignaciosantise 000dc2a
fix: add source file check in copy_if_missing function
ignaciosantise 7d08b54
chore: move conductor scripts to another folder
ignaciosantise 7b8ec54
Merge branch 'main' into chore/worktree-scripts-and-agents-docs
ignaciosantise File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "setupScript": "./scripts/conductor/setup-worktree.sh", | ||
| "archiveScript": "./scripts/conductor/cleanup-worktree.sh" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,220 @@ | ||
| # Agent Documentation: W3MWagmi | ||
|
|
||
| This file provides guidance to AI agents when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| **W3MWagmi** is a React Native sample application demonstrating the **Reown AppKit SDK** for multichain Web3 integration. It showcases wallet connection, signing, and transaction capabilities across multiple blockchain ecosystems: | ||
|
|
||
| - **EVM chains** (Ethereum, Polygon, Arbitrum, Optimism, Base, etc.) | ||
| - **Solana** (via Phantom & Solflare wallets) | ||
| - **Bitcoin** (PSBT signing) | ||
|
|
||
| This is a reference implementation for developers building dApps with Reown AppKit. | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| ### Core Technologies | ||
| - **React Native**: 0.81.4 | ||
| - **React**: 19.1.0 | ||
| - **TypeScript**: ^5.8.3 | ||
| - **Expo**: 54.0.20 | ||
|
|
||
| ### Reown AppKit SDKs | ||
| - **@reown/appkit-react-native**: Core AppKit SDK | ||
| - **@reown/appkit-wagmi-react-native**: EVM integration via Wagmi | ||
| - **@reown/appkit-solana-react-native**: Solana support | ||
| - **@reown/appkit-bitcoin-react-native**: Bitcoin support | ||
| - **@reown/appkit-coinbase-react-native**: Coinbase wallet integration | ||
|
|
||
| ### Blockchain Libraries | ||
| - **wagmi**: EVM hooks & utilities | ||
| - **viem**: Ethereum JavaScript client | ||
| - **@solana/web3.js**: Solana client | ||
| - **bitcoinjs-lib**: Bitcoin library | ||
|
|
||
| ### Key Libraries | ||
| - **@react-navigation**: Navigation (native-stack, bottom-tabs) | ||
| - **valtio**: Reactive state management | ||
| - **@tanstack/react-query**: Server state management | ||
| - **react-native-mmkv**: Fast key-value storage | ||
| - **@sentry/react-native**: Error tracking | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Project Structure | ||
|
|
||
| ``` | ||
| W3MWagmi/ | ||
| ├── src/ | ||
| │ ├── App.tsx # Root component with providers | ||
| │ ├── screens/ | ||
| │ │ ├── Connections/ # Main wallet connection & actions | ||
| │ │ │ └── components/ # Chain-specific action views | ||
| │ │ │ ├── ActionsView.tsx | ||
| │ │ │ ├── WagmiActionsView.tsx # EVM transactions | ||
| │ │ │ ├── SolanaActionsView.tsx # Solana actions | ||
| │ │ │ ├── BitcoinActionsView.tsx # Bitcoin actions | ||
| │ │ │ ├── WalletInfoView.tsx | ||
| │ │ │ └── EventsView.tsx | ||
| │ │ ├── Settings/ # Device & wallet info | ||
| │ │ ├── LogList/ # App activity logs | ||
| │ │ └── AppKitLogList/ # AppKit library logs | ||
| │ ├── navigators/ | ||
| │ │ ├── RootStackNavigator.tsx | ||
| │ │ └── HomeTabNavigator.tsx | ||
| │ ├── stores/ | ||
| │ │ └── SettingsStore.ts # Valtio-based state | ||
| │ ├── utils/ | ||
| │ │ ├── WagmiUtils.ts # Chain configuration | ||
| │ │ ├── BitcoinUtil.ts # Bitcoin helpers | ||
| │ │ ├── eip712.ts # EIP-712 signing | ||
| │ │ └── ... | ||
| │ ├── hooks/ | ||
| │ │ ├── useLogs.ts | ||
| │ │ ├── useSocketStatus.ts | ||
| │ │ └── useTheme.ts | ||
| │ └── assets/ | ||
| ├── android/ | ||
| ├── ios/ | ||
| ├── scripts/ | ||
| └── package.json | ||
| ``` | ||
|
|
||
| ### State Management | ||
|
|
||
| - **Valtio**: Lightweight reactive proxy-based state (`stores/SettingsStore.ts`) | ||
| - **React Query**: Server state and caching for blockchain data | ||
|
|
||
| ### Navigation | ||
|
|
||
| Uses **React Navigation** with: | ||
| - Bottom tab navigator (4 tabs: Connections, Settings, Logs, AppKit Logs) | ||
| - Stack navigator for modal screens | ||
|
|
||
| ## Key Features | ||
|
|
||
| ### Wallet Connection | ||
| - AppKit modal for wallet selection | ||
| - Support for 14+ EVM chains | ||
| - Solana wallet integration (Phantom, Solflare) | ||
| - Bitcoin wallet support | ||
| - Coinbase Wallet Mobile SDK | ||
| - WalletConnect Link Mode | ||
|
|
||
| ### Blockchain Actions | ||
|
|
||
| **EVM (Wagmi)** | ||
| - Sign message | ||
| - Send transactions | ||
| - Estimate gas | ||
| - Sign typed data (EIP-712) | ||
|
|
||
| **Solana** | ||
| - Sign message | ||
| - Sign transaction | ||
| - Send transaction | ||
|
|
||
| **Bitcoin** | ||
| - Sign message (ECDSA) | ||
| - Sign PSBT | ||
|
|
||
| ### Developer Features | ||
| - Real-time socket status monitoring | ||
| - App activity logs | ||
| - AppKit library event logs | ||
| - Device information display | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| Required in `.env`: | ||
| ```bash | ||
| ENV_PROJECT_ID="" # Reown dashboard project ID (required) | ||
| ENV_SENTRY_DSN="" # Sentry error tracking (optional) | ||
| SENTRY_DISABLE_AUTO_UPLOAD=true # Disable Sentry auto upload for Android builds | ||
| ``` | ||
|
|
||
| ## Development | ||
|
|
||
| ### Setup | ||
| ```bash | ||
| yarn install | ||
| cp .env.example .env | ||
| # Edit .env with your project ID | ||
| yarn android # or yarn ios | ||
| ``` | ||
|
|
||
| ### Scripts | ||
| - `yarn start`: Start Metro bundler | ||
| - `yarn android`: Run on Android (debug) | ||
| - `yarn ios`: Run on iOS | ||
| - `yarn android:build`: Build release APK | ||
| - `yarn lint`: Run ESLint | ||
| - `yarn test`: Run Jest tests | ||
|
|
||
| ### Build Variants | ||
| - **debug**: Local development | ||
| - **internal**: Internal testing | ||
| - **production**: Release builds | ||
|
|
||
| ```bash | ||
| yarn run copy:debug # Copy debug config files | ||
| yarn run copy:internal # Copy internal config files | ||
| yarn run copy:production # Copy production config files | ||
| ``` | ||
|
|
||
| ## Common Patterns | ||
|
|
||
| ### AppKit Setup (App.tsx) | ||
|
|
||
| ```typescript | ||
| import { createAppKit } from '@reown/appkit-react-native'; | ||
| import { WagmiProvider } from 'wagmi'; | ||
|
|
||
| // Initialize AppKit with project ID and chains | ||
| createAppKit({ | ||
| projectId: ENV_PROJECT_ID, | ||
| // ... configuration | ||
| }); | ||
| ``` | ||
|
|
||
| ### Using Wagmi Hooks | ||
|
|
||
| ```typescript | ||
| import { useAccount, useSignMessage, useSendTransaction } from 'wagmi'; | ||
|
|
||
| const { address, isConnected } = useAccount(); | ||
| const { signMessage } = useSignMessage(); | ||
| ``` | ||
|
|
||
| ### Valtio State | ||
|
|
||
| ```typescript | ||
| import { proxy, useSnapshot } from 'valtio'; | ||
|
|
||
| const SettingsStore = proxy({ | ||
| // state | ||
| }); | ||
|
|
||
| // In component | ||
| const { value } = useSnapshot(SettingsStore); | ||
| ``` | ||
|
|
||
| ## Code Quality Guidelines | ||
|
|
||
| ### After Making Changes | ||
|
|
||
| **Always run these checks and fix any errors before committing:** | ||
|
|
||
| ```bash | ||
| yarn lint # Check and fix ESLint errors | ||
| yarn prettier --write . # Format code with Prettier | ||
| npx tsc --noEmit # Check for TypeScript errors | ||
| ``` | ||
|
|
||
| ### Style | ||
| - Use TypeScript strict mode | ||
| - Follow ESLint + Prettier configuration | ||
| - Use path aliases (`@/`) for imports | ||
| - Handle errors with toast notifications | ||
| - Log important events for debugging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,21 @@ | ||
| # bash script that copies the mock files to the correct location | ||
| #!/bin/zsh | ||
| # Script that copies mock files to the correct location (skips if file exists) | ||
|
|
||
| cp .env.example .env | ||
| cp android/app/debug.keystore.mock android/app/debug.keystore | ||
| cp android/secrets.properties.mock android/secrets.properties | ||
| copy_if_missing() { | ||
ignaciosantise marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| local src="$1" | ||
| local dest="$2" | ||
| if [ ! -f "$src" ]; then | ||
| echo "Skipped (source not found): $src" | ||
| return | ||
| fi | ||
| if [ -f "$dest" ]; then | ||
| echo "Skipped (exists): $dest" | ||
| return | ||
| fi | ||
| cp "$src" "$dest" | ||
| echo "Copied: $dest" | ||
| } | ||
|
|
||
| copy_if_missing .env.example .env | ||
| copy_if_missing android/app/debug.keystore.mock android/app/debug.keystore | ||
| copy_if_missing android/secrets.properties.mock android/secrets.properties | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.