How clarkjoao/dappkit works
Project Type and Purpose
• This is a TypeScript-based JavaScript SDK (“dappkit”) for Web3 projects. It provides:
• A unified Web3 connection layer
• Curated, ready-to-use contract wrappers (ERC20, ERC4626, Sablier, Uniswap, custom contracts, etc.)
• Shared base classes, interface definitions, models, utilities
• Command-line/build tools for compiling and cleaning contract ABIs
• Intended for both client-side (browser) and server-side (Node.js) use.
File Structure Highlights
• contracts/… : Solidity source code and protocol-specific subfolders
• src/
• base/ : generic contract-wrapper primitives (Ownable, Pausable, Stakeable, IPFS wrapper, Web3Connection)
• interfaces/ : typed method signatures, event and modifier definitions
• models/ : concrete wrappers around specific contracts (ERC20, UniswapRouter, Sablier, etc.)
• utils/ : helper functions (transaction handling, JSON-RPC param formatting, constant definitions)
• index.ts : public API aggregation
• tools/ : scripts (compile.mjs, contract-json-cleaner.mjs, size checks)
• test/ : unit and integration tests for base, models, utils
• docker-compose.yml & Dockerfile: local chain & environment setup for CI/tests
• CI: GitHub Actions integration-tests.yml
Additional README Insights
• Emphasis on instantiating Web3Connection, then using model classes to deploy/interact
• Guides for client, server, advanced usage (IPFS, custom ABI, Docker)
• Published to npm (@taikai/dappkit), docs auto-generated via npm run docs
1. Developer Application
• Browser or Node.js code importing dappkit
2. dappkit SDK
• Public API (src/index.ts)
• Web3Connection module
• Contract Wrapper layer
– Base primitives (Ownable, Pausable, use-model, web3-contract)
– Models (ERC20, Sablier, Uniswap, custom)
– Interfaces (method/event definitions)
• Utility layer (transaction handler, JSON-RPC params, constants)
• IPFS wrapper (optional metadata/pin)
3. Build & Tooling
• tools/compile.mjs → compiles Solidity under contracts/ → JSON ABIs
• contract-json-cleaner → strips extra fields
4. Test & CI Environment
• test/ suites triggered by GitHub Actions
• docker-compose local blockchain node for integration tests
5. External Services
• Blockchain RPC endpoint (Infura, Alchemy, local Geth)
• IPFS gateway or node
• NPM registry (package publish)
• Developer App → imports → dappkit Public API
• Public API → uses → Web3Connection to establish JSON-RPC channel to Blockchain
• Contract Wrappers → invoke → Web3Connection.web3 → send transactions or calls
• Web3Connection → returns → Promises (tx receipts, chain data) back to App
• IPFS Wrapper → sends/receives → HTTP API to IPFS node/gateway
• tools/compile.mjs → reads → contracts/ → outputs → build artifacts → published in npm
• CI pipeline → runs → tests against local blockchain via Docker
c. Architectural Patterns and Principles:
• Layered architecture: Public API → Domain (models & interfaces) → Infrastructure (web3 + IPFS)
• Wrapper/Adapter pattern for contracts
• Factory pattern in model constructors for contract instantiation
• Single Responsibility: each module has one clear purpose (connection vs. model vs. util)
• Extensibility through new models/interfaces under src/models & src/interfaces
d. Key Technologies & Frameworks:
• TypeScript (tsconfig.json)
• web3.js (wrapped in Web3Connection)
• IPFS HTTP API wrapper
• Solidity compiler (via tools/compile.mjs)
• Docker & docker-compose for local chain
• GitHub Actions for CI
• npm for package management
Final Advice
• 4 layers (Application, SDK, Tooling, External) in one cohesive view
• Don’t omit the compile-to-ABI/build pipeline and the CI/test harness
• Detail how modules relate: models rely on base, which rely on Web3Connection
• Both read-only (call) and transactional (send) flows