TypeScript SDK for interacting with Effective Acceleration, a decentralized peer-to-peer marketplace for jobs and services.
- Multi-wallet support - Compatible with ethers providers, JSON RPC, and private key connections
- Complete job lifecycle - Create, update, take, deliver, and complete jobs
- User management - Register users and arbitrators with profiles
- Messaging system - Encrypted communication between parties
- Dispute resolution - Built-in arbitration system
- Type-safe - Full TypeScript support with proper types
- IPFS integration - Decentralized content storage
npm install eacc-ts ethers
import { EACCClient } from 'eacc-ts';
import { ethers } from 'ethers';
// Initialize the client
const client = new EACCClient({
marketplaceV2Address: '0x...',
marketplaceDataV1Address: '0x...',
chainId: 42161, // Arbitrum One
});
// Register as a user
await client.registerUser({
pubkey: '0x...',
name: 'John Doe',
bio: 'Full-stack developer',
avatar: 'https://example.com/avatar.jpg'
});
// Publish a job
const jobId = await client.publishJob({
title: 'Build a React App',
contentHash: 'Qm...', // IPFS hash with job details
multipleApplicants: true,
tags: ['DA', 'react', 'javascript'],
token: '0x...', // ERC20 token address
amount: ethers.utils.parseEther('1'),
maxTime: 86400 * 7, // 7 days in seconds
deliveryMethod: 'IPFS'
});
console.log('Job published with ID:', jobId.toString());
- Open (0): Job is available for workers to apply
- Taken (1): Worker has been assigned and escrow is active
- Closed (2): Job completed or cancelled
Every job must include exactly one MECE (Mutually Exclusive, Collectively Exhaustive) tag:
- DA: Digital Audio
- DV: Digital Video
- DT: Digital Text
- DS: Digital Software
- DO: Digital Others
- NDG: Non-Digital Goods
- NDS: Non-Digital Services
- NDO: Non-Digital Others
const client = new EACCClient({
marketplaceV2Address: string,
marketplaceDataV1Address: string,
chainId?: number,
ipfsConfig?: {
gateway?: string,
apiEndpoint?: string
}
});
// Private key
await client.connectWithPrivateKey(privateKey, rpcUrl);
// Custom provider
await client.connectProvider(provider);
// Register user
await client.registerUser({
pubkey: string,
name: string,
bio: string,
avatar: string
});
// Update profile
await client.updateUser({
name: string,
bio: string,
avatar: string
});
// Get user info
const user = await client.getUser(address);
const rating = await client.getUserRating(address);
const reviews = await client.getUserReviews(address, 0, 10);
// Publish job
const jobId = await client.publishJob({
title: string,
contentHash: string,
multipleApplicants: boolean,
tags: string[],
token: string,
amount: BigNumber,
maxTime: number,
deliveryMethod: string,
arbitrator?: string,
allowedWorkers?: string[]
});
// Take job
await client.takeJob(jobId, signature);
// Deliver result
await client.deliverResult(jobId, resultHash);
// Approve and complete
await client.approveResult(jobId, rating, review);
// Upload content to IPFS
const hash = await client.uploadToIPFS(content, apiKey);
// Fetch content from IPFS
const content = await client.fetchFromIPFS(hash);
Check out the /examples
directory for complete usage examples:
basic-usage.ts
- Basic SDK setup and connectionpublish-job.ts
- Creating and publishing a jobtake-job.ts
- Worker taking and completing a jobregister-user.ts
- User and arbitrator registration
# Install dependencies
npm install
# Build the project
npm run build
# Run examples
npm run example:basic
npm run example:publish
npm run example:take
npm run example:register
# Run tests
npm test
- MarketplaceV2: 0x405AcFbD1400A168fDd4aDA2D214e8Ae5FF7a624
- MarketplaceDataV1: 0x0191ae69d05F11C7978cCCa2DE15653BaB509d9a
- MarketplaceV2: TBD
- MarketplaceDataV1: TBD
The SDK includes comprehensive error handling:
try {
await client.takeJob(jobId, signature);
} catch (error) {
if (error.message.includes('not registered')) {
console.log('User not registered, please register first');
} else if (error.message.includes('not whitelisted')) {
console.log('Worker not whitelisted for this job');
}
}
- Fork the repository
- Create your feature branch (
git checkout -b feat/your-feature
) - Commit your changes (
git commit -m 'Add some feature'
) - Push to the branch (
git push origin feat/your-feature
) - Open a Pull Request
This project is licensed under the MIT License.