Welcome to the OPTN Wallet project! This guide is designed to help you get started with the development environment, understand the project layout, and build the application for web and mobile platforms. For more information about the project, visit our website.
The project is organized to clearly separate frontend components, API interactions, and backend services. Here’s a breakdown of the key directories and files:
-
Root Configuration & Build Files:
.editorconfig,.eslintrc.cjs,.eslintrc.json,.prettierrc– Code style and formatting configurations.package.json,package-lock.json– Project metadata and dependency management.tsconfig.json,tsconfig.node.json– TypeScript configuration files.vite.config.ts– Vite configuration for building the app.tailwind.config.js– Tailwind CSS configuration.capacitor.config.ts– Configuration for mobile builds using Capacitor.
-
Source Code (
srcfolder):-
Entry Points & Global Assets:
App.tsx– Main React entry point.index.html,index.css,main.tsx– Base HTML and styling files.
-
**API Modules (
src/apis):**Modules here handle interactions with external APIs and blockchain-related operations:- AddressManager – Manages wallet addresses.
- ChaingraphManager – Interacts with blockchain data graphs.
- ContractManager – Manages smart contract interactions and holds contract artifacts.
- DatabaseManager – Interfaces with the internal database.
- ElectrumServer – Manages communication with the Electrum server.
- TransactionManager – Constructs and processes transactions.
- UTXOManager – Handles UTXO (Unspent Transaction Output) management.
- WalletManager – Manages wallet creation, key generation, and related functions.
-
**Frontend Components (
src/components):**Contains all reusable React components for the user interface:- General UI elements (e.g.,
AboutView.tsx,BitcoinCashCard.tsx,WalletCreate.tsx, etc.). - Specialized components organized in subdirectories like
modules(e.g.,NetworkSwitch.tsx) andtransaction(e.g.,TransactionActions.tsx).
- General UI elements (e.g.,
-
**Pages (
src/pages):**Represents the different views and routes of the application:- Pages like
Home.tsx,CreateWallet.tsx,ImportWallet.tsx,Settings.tsx, and more.
- Pages like
-
**State Management (
src/redux):**Houses Redux slices, selectors, and store configuration:- Files such as
contractSlice.ts,networkSlice.ts,priceFeedSlice.ts, among others, along with selectors and the main store.
- Files such as
-
**Backend Services (
src/services):**Provides additional business logic and supports API calls:- Services like
ElectrumService.ts,KeyService.ts,TransactionService.ts, andUTXOService.ts.
- Services like
-
**Custom Hooks (
src/hooks):**Contains React hooks for handling logic like data fetching and transaction processing:- Files such as
useContractFunction.ts,useFetchWalletData.ts,useHandleTransaction.ts.
- Files such as
-
Utilities & Types:
- Utilities (
src/utils): Includes helper functions, constants, and schema validations. - Types (
src/types): TypeScript definitions for consistent type usage across the project.
- Utilities (
-
**Web Workers (
src/workers):**Offloads heavy computations or background tasks to separate threads:- Worker services like
TransactionWorkerService.ts,UTXOWorkerService.ts, andpriceFeedWorker.ts.
- Worker services like
-
-
Additional Folders:
- Patches (
patchesfolder): Contains patches applied to third-party dependencies when needed.
- Patches (
The source code for the OPTN Wallet is hosted on GitHub. You can find the repository at the following link: GitHub Repository
-
Clone the Repository
git clone https://github.com/BitcoinBay/OPTNWallet.git cd OPTNWallet -
Install Dependencies
npm install
-
Run Development Server
npm run dev
-
Initialize Capacitor
npm run capacitor:init
-
Add Android Platform
npm run capacitor:add:android
-
Copy Web Assets
npm run capacitor:copy
-
Sync Capacitor Plugins
npm run capacitor:sync
-
Open Android Studio
npm run capacitor:open:android
-
Build the Project
- For Android: Use Android Studio to build and run the project on an emulator or a physical device.
- For iOS: Open the
iosfolder in Xcode and build the project.
- Start Development Server:
npm run dev - Build for Production:
npm run build - Lint the Code:
npm run lint - Preview the Production Build:
npm run preview - Format the Code:
npm run format - Serve the Production Build:
npm run serve
We welcome contributions from the community! Join our Telegram Group to connect with the developers and other contributors.
Thank you for your interest in the OPTN Wallet project!