Files

157 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

2026-01-01 08:04:06 -08:00
# Setup Guide
Complete setup instructions for Chain 138 full enablement project.
## Prerequisites
- Node.js >= 18.0.0
- pnpm >= 8.0.0 (or use corepack: `corepack enable`)
## Installation
1. Clone the repository (if applicable)
2. Install dependencies:
```bash
pnpm install
```
## Building
Build all packages:
```bash
pnpm build
```
Build a specific package:
```bash
pnpm --filter @dbis-thirdweb/chain build
```
## Testing
### Setup Test Environment
1. Create test environment file:
```bash
cd apps/smoke-tests
cp .env.example .env
```
2. Edit `.env` and add your test private key:
```bash
TEST_PRIVATE_KEY=your_private_key_here
TEST_RPC_URL=https://138.rpc.thirdweb.com # Optional
TEST_RECIPIENT=0x0000000000000000000000000000000000000001 # Optional
```
### Run Tests
Run all smoke tests:
```bash
pnpm smoke-tests
```
Or from the smoke-tests directory:
```bash
cd apps/smoke-tests
pnpm test
```
Run specific test suite:
```bash
cd apps/smoke-tests
pnpm test:wallets
pnpm test:x402
pnpm test:bridge
pnpm test:tokens
pnpm test:ai
pnpm test:http-api
```
## Using the Packages
### In Your Project
Install packages locally (if published):
```bash
pnpm add @dbis-thirdweb/chain @dbis-thirdweb/wallets
```
Or use workspace packages directly (in this monorepo):
```typescript
import { chain138 } from '@dbis-thirdweb/chain';
import { getWalletConfig } from '@dbis-thirdweb/wallets';
```
### Example Usage
```typescript
import { ThirdwebSDK } from '@thirdweb-dev/sdk';
import { chain138 } from '@dbis-thirdweb/chain';
import { getWalletConfig } from '@dbis-thirdweb/wallets';
// Initialize SDK with Chain 138
const sdk = new ThirdwebSDK(chain138, privateKey);
// Get wallet configuration
const config = getWalletConfig({
confirmationBlocks: 2,
});
```
See individual package READMEs for detailed usage examples.
## Development
### Linting
Lint all packages:
```bash
pnpm lint
```
### Package Structure
```
packages/
chain/ - Chain 138 definition (CAIP-2: eip155:138)
wallets/ - Wallet config & chain switching
x402/ - Payment primitives & pay-to-access
bridge/ - Bridge routes & execution
tokens/ - ERC20/721/1155 token management
ai/ - Chain-aware AI prompts & actions
http-api/ - HTTP API client wrapper
apps/
smoke-tests/ - End-to-end tests for all offerings
```
## Troubleshooting
### Build Errors
- Ensure all dependencies are installed: `pnpm install`
- Clear build cache and rebuild: `rm -rf packages/*/dist && pnpm build`
### Test Failures
- Verify `TEST_PRIVATE_KEY` is set in `apps/smoke-tests/.env`
- Check RPC endpoint is accessible: `curl https://138.rpc.thirdweb.com`
- Ensure test account has sufficient balance for transactions
### Type Errors
- Rebuild all packages: `pnpm build`
- Check TypeScript version compatibility
- Verify workspace dependencies are linked: `pnpm list --depth=0`
## Next Steps
1. Configure your test environment (`.env` file)
2. Run smoke tests to verify all offerings work
3. Integrate packages into your application
4. Deploy to production when ready
For detailed package documentation, see individual README files in each package directory.