3.1 KiB
3.1 KiB
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
-
Clone the repository (if applicable)
-
Install dependencies:
pnpm install
Building
Build all packages:
pnpm build
Build a specific package:
pnpm --filter @dbis-thirdweb/chain build
Testing
Setup Test Environment
- Create test environment file:
cd apps/smoke-tests
cp .env.example .env
- Edit
.envand add your test private key:
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:
pnpm smoke-tests
Or from the smoke-tests directory:
cd apps/smoke-tests
pnpm test
Run specific test suite:
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):
pnpm add @dbis-thirdweb/chain @dbis-thirdweb/wallets
Or use workspace packages directly (in this monorepo):
import { chain138 } from '@dbis-thirdweb/chain';
import { getWalletConfig } from '@dbis-thirdweb/wallets';
Example Usage
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:
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_KEYis set inapps/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
- Configure your test environment (
.envfile) - Run smoke tests to verify all offerings work
- Integrate packages into your application
- Deploy to production when ready
For detailed package documentation, see individual README files in each package directory.