{"_id":"@craftec/scalecraft-sdk","_rev":"6-051a4827ad48d988fc5faeaf2227df84","name":"@craftec/scalecraft-sdk","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.0":{"name":"@craftec/scalecraft-sdk","version":"0.1.0","keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"author":{"name":"Craftec"},"license":"MIT","_id":"@craftec/scalecraft-sdk@0.1.0","maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"homepage":"https://github.com/craftec/scalecraft#readme","bugs":{"url":"https://github.com/craftec/scalecraft/issues"},"dist":{"shasum":"98eaf6bd02aa67f92b1a4339f174411d8ed11b4a","tarball":"https://registry.npmjs.org/@craftec/scalecraft-sdk/-/scalecraft-sdk-0.1.0.tgz","fileCount":7,"integrity":"sha512-PZMMKvxJxzq39wdAMN9hU730yXX/HMRj4uHyjdhYgt7QL79y0n/41jX/nN5MfUg5jQZCUDmIoQFzKEN9+e7y8Q==","signatures":[{"sig":"MEYCIQDYhOSFxz1aTSkPa/awboIuRxuyp0VmW4eqTo8+agAlagIhAJ96oOCpCZ0scCCWnAJlp3pUJOlFCWnGS4XbzgmPSW/D","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1105455},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"aeaa29368e756e89e0b955ac65ac4bb2977b0ff1","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src/","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"onlyabrak","email":"mhafizms@gmail.com"},"repository":{"url":"git+https://github.com/craftec/scalecraft.git","type":"git","directory":"packages/sdk"},"_npmVersion":"11.3.0","description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","directories":{},"_nodeVersion":"22.15.0","dependencies":{"@solana/web3.js":"^1.95.8","@coral-xyz/anchor":"^0.30.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@solana/web3.js":">=1.90.0","@coral-xyz/anchor":">=0.30.0"},"_npmOperationalInternal":{"tmp":"tmp/scalecraft-sdk_0.1.0_1767202216556_0.20730617198057577","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@craftec/scalecraft-sdk","version":"0.1.1","keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"author":{"name":"Craftec"},"license":"MIT","_id":"@craftec/scalecraft-sdk@0.1.1","maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"homepage":"https://github.com/craft-ec/scalecraft-sdk#readme","bugs":{"url":"https://github.com/craft-ec/scalecraft-sdk/issues"},"dist":{"shasum":"cb295877c0ccda8e8a5c305a9676ac02955ddac7","tarball":"https://registry.npmjs.org/@craftec/scalecraft-sdk/-/scalecraft-sdk-0.1.1.tgz","fileCount":7,"integrity":"sha512-8e+Z7Qt1phXn0Ss6CcMmKhMjsBVOw41b1N+py601gUWlNhsdKQhAsV1dfB9lJk+Bd+zor8lFMVH6KIk7u2Ny0Q==","signatures":[{"sig":"MEQCICGE7Ur3Dp5SCav34FiSD27kJ4a65Q2dB6f/zdoO9nSZAiBTFjoxBvy+f8VQWYJlqjurJ/95AiVGHSxEWnb2EWiryQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1158263},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"c8e0f9a7848a52c8e3960a500eb10b5930644e15","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src/","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"onlyabrak","email":"mhafizms@gmail.com"},"repository":{"url":"git+https://github.com/craft-ec/scalecraft-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","directories":{},"_nodeVersion":"22.15.0","dependencies":{"@solana/web3.js":"^1.95.8","@coral-xyz/anchor":"^0.30.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@solana/web3.js":">=1.90.0","@coral-xyz/anchor":">=0.30.0"},"_npmOperationalInternal":{"tmp":"tmp/scalecraft-sdk_0.1.1_1767782419882_0.1476947636077257","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@craftec/scalecraft-sdk","version":"0.1.2","keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"author":{"name":"Craftec"},"license":"MIT","_id":"@craftec/scalecraft-sdk@0.1.2","maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"homepage":"https://github.com/craft-ec/scalecraft-sdk#readme","bugs":{"url":"https://github.com/craft-ec/scalecraft-sdk/issues"},"dist":{"shasum":"b67ffcaf52440ccdaadab7ba0ff3faa5e68044b8","tarball":"https://registry.npmjs.org/@craftec/scalecraft-sdk/-/scalecraft-sdk-0.1.2.tgz","fileCount":7,"integrity":"sha512-7hEVL0bth8GmfPJ7PS4wuhriZ5PMzOxeGLEpbdEhpgHWnMuQWNRu/Tqp9/VEKAfTBdMdpMs80WduzZYyKfiYTw==","signatures":[{"sig":"MEUCIDoMyq4Sjfvwbf59m4xeEUbQE9zZWR/m00yqBjuh6SzcAiEA2QRqIJaNCSnGoWgUjnEWLTU/dw0AN2uS2g1jlRpephE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1165566},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"1dbac08b8b049c98dbea91bb2e8fbf338adddb7c","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src/","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"onlyabrak","email":"mhafizms@gmail.com"},"repository":{"url":"git+https://github.com/craft-ec/scalecraft-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","directories":{},"_nodeVersion":"22.15.0","dependencies":{"@solana/web3.js":"^1.95.8","@coral-xyz/anchor":"^0.30.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@solana/web3.js":">=1.90.0","@coral-xyz/anchor":">=0.30.0"},"_npmOperationalInternal":{"tmp":"tmp/scalecraft-sdk_0.1.2_1767783019960_0.2691411038365703","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@craftec/scalecraft-sdk","version":"0.1.4","keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"author":{"name":"Craftec"},"license":"MIT","_id":"@craftec/scalecraft-sdk@0.1.4","maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"homepage":"https://github.com/craft-ec/scalecraft-sdk#readme","bugs":{"url":"https://github.com/craft-ec/scalecraft-sdk/issues"},"dist":{"shasum":"36be1a74f6c8fefb49a79b004bd93918bca886a6","tarball":"https://registry.npmjs.org/@craftec/scalecraft-sdk/-/scalecraft-sdk-0.1.4.tgz","fileCount":7,"integrity":"sha512-76zzmCJ3gvJvTZZSbXDLrAaDR8syHNB6eyS8KW1iO2jVOWH6T8ilHmJkV1x3efWgkK03pqM8q0U4+JpMPificw==","signatures":[{"sig":"MEYCIQCZYtLnaHQPWrFWql26jj3BOrvtmgVjqpNuSVTBGG9tDwIhAIVQhElR493zHmxmp2OEtsg48rf5Y3gavqf4mWLY0fvY","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1168668},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"1dbac08b8b049c98dbea91bb2e8fbf338adddb7c","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src/","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"onlyabrak","email":"mhafizms@gmail.com"},"repository":{"url":"git+https://github.com/craft-ec/scalecraft-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","directories":{},"_nodeVersion":"22.15.0","dependencies":{"@solana/web3.js":"^1.95.8","@coral-xyz/anchor":"^0.30.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@solana/web3.js":">=1.90.0","@coral-xyz/anchor":">=0.30.0"},"_npmOperationalInternal":{"tmp":"tmp/scalecraft-sdk_0.1.4_1767787619986_0.5148200998582322","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@craftec/scalecraft-sdk","version":"0.1.5","keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"author":{"name":"Craftec"},"license":"MIT","_id":"@craftec/scalecraft-sdk@0.1.5","maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"homepage":"https://github.com/craft-ec/scalecraft-sdk#readme","bugs":{"url":"https://github.com/craft-ec/scalecraft-sdk/issues"},"dist":{"shasum":"2aa3abfb6e0a4088a4561d431cbe6cc9638b0e09","tarball":"https://registry.npmjs.org/@craftec/scalecraft-sdk/-/scalecraft-sdk-0.1.5.tgz","fileCount":7,"integrity":"sha512-LdQX6aKgaUfA1yqk0nQrmahhEqt5oy79vVZz49vmEh0AdRIGl47OepIJtJLSWENlhaR/cYurGjYKFVLEeMORbA==","signatures":[{"sig":"MEUCIQDd0Qw+Bd0KhI1AzZqk+YdFQ592gg+blWRS35rqm5gM3gIgKS7QLwxJCzB5SiguMaUua9UVPeDdpm7PH4QhdDsUSn4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1172060},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"1cfb87a8adfc8fd9c7d771a01403db8c6aecafa7","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src/","build":"tsup src/index.ts --format cjs,esm --dts","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"onlyabrak","email":"mhafizms@gmail.com"},"repository":{"url":"git+https://github.com/craft-ec/scalecraft-sdk.git","type":"git"},"_npmVersion":"11.3.0","description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","directories":{},"_nodeVersion":"22.15.0","dependencies":{"@solana/web3.js":"^1.95.8","@coral-xyz/anchor":"^0.30.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"@solana/web3.js":">=1.90.0","@coral-xyz/anchor":">=0.30.0"},"_npmOperationalInternal":{"tmp":"tmp/scalecraft-sdk_0.1.5_1767798221421_0.16089418748292794","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@craftec/scalecraft-sdk","version":"0.1.6","description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","author":{"name":"Craftec"},"license":"MIT","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src/","typecheck":"tsc --noEmit","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build"},"dependencies":{"@coral-xyz/anchor":"^0.30.1","@solana/web3.js":"^1.95.8"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","typescript":"^5.0.0"},"peerDependencies":{"@coral-xyz/anchor":">=0.30.0","@solana/web3.js":">=1.90.0"},"keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"repository":{"type":"git","url":"git+https://github.com/craft-ec/scalecraft-sdk.git"},"homepage":"https://github.com/craft-ec/scalecraft-sdk#readme","bugs":{"url":"https://github.com/craft-ec/scalecraft-sdk/issues"},"engines":{"node":">=18.0.0"},"_id":"@craftec/scalecraft-sdk@0.1.6","gitHead":"39caa580acbb6a04cf88e38aa7b18a37f0797d31","_nodeVersion":"22.15.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-Y5qpnZ1owpT0/qn7pg0qFwZijR5S3f3/yThEZ8ezs4stTxM6VFXnrvnRYzLAONK1fgAnxG/4jL6QNttM2Up49w==","shasum":"9e008606ff8f91dc29c8a7ef1aa8607e64988c8e","tarball":"https://registry.npmjs.org/@craftec/scalecraft-sdk/-/scalecraft-sdk-0.1.6.tgz","fileCount":7,"unpackedSize":1178756,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDEq2PGaPqGM1lSTj3vZcQBOpk4WNAM2nsUIEG0yDTpegIgE7ubzrc+qq7/xtj/Ha5hHmPKbaWRJGXM8zeNGsKTuRw="}]},"_npmUser":{"name":"onlyabrak","email":"mhafizms@gmail.com"},"directories":{},"maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/scalecraft-sdk_0.1.6_1769594258272_0.06942150223856669"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-31T17:30:16.453Z","modified":"2026-01-28T09:57:38.567Z","0.1.0":"2025-12-31T17:30:16.720Z","0.1.1":"2026-01-07T10:40:20.021Z","0.1.2":"2026-01-07T10:50:20.123Z","0.1.4":"2026-01-07T12:07:00.162Z","0.1.5":"2026-01-07T15:03:41.581Z","0.1.6":"2026-01-28T09:57:38.442Z"},"bugs":{"url":"https://github.com/craft-ec/scalecraft-sdk/issues"},"author":{"name":"Craftec"},"license":"MIT","homepage":"https://github.com/craft-ec/scalecraft-sdk#readme","keywords":["solana","anchor","scalecraft","craftec","arbitration","dispute-resolution","decentralized","blockchain","sdk","web3"],"repository":{"type":"git","url":"git+https://github.com/craft-ec/scalecraft-sdk.git"},"description":"SDK for interacting with ScaleCraft - decentralized arbitration on Solana","maintainers":[{"name":"onlyabrak","email":"mhafizms@gmail.com"}],"readme":"# @craftec/scalecraft-sdk\n\nSDK for integrating with ScaleCraft - a multi-tenant decentralized arbitration protocol on Solana.\n\n## Installation\n\n```bash\nnpm install @craftec/scalecraft-sdk\n```\n\n## Platform Integration Guide\n\nScaleCraft uses a **namespace-based multi-tenant architecture**. Each platform gets its own isolated namespace with independent protocol configuration, subjects, and disputes.\n\n### Architecture Overview\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                     ScaleCraft Program                          │\n├─────────────────────────────────────────────────────────────────┤\n│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐          │\n│  │  Namespace A │  │  Namespace B │  │  Namespace C │          │\n│  │  (Platform)  │  │  (Platform)  │  │  (Platform)  │          │\n│  ├──────────────┤  ├──────────────┤  ├──────────────┤          │\n│  │ • Config     │  │ • Config     │  │ • Config     │          │\n│  │ • Subjects   │  │ • Subjects   │  │ • Subjects   │          │\n│  │ • Disputes   │  │ • Disputes   │  │ • Disputes   │          │\n│  │ • Escrows    │  │ • Escrows    │  │ • Escrows    │          │\n│  └──────────────┘  └──────────────┘  └──────────────┘          │\n├─────────────────────────────────────────────────────────────────┤\n│  Shared Pools (Global)                                          │\n│  ┌────────────────┐ ┌─────────────────┐ ┌────────────────┐     │\n│  │ Defender Pools │ │ Challenger Pools│ │  Juror Pools   │     │\n│  └────────────────┘ └─────────────────┘ └────────────────┘     │\n└─────────────────────────────────────────────────────────────────┘\n```\n\n### Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **Namespace** | Unique identifier for your platform (e.g., \"myplatform\"). First-come-first-served, globally unique. |\n| **Protocol Config** | Per-namespace configuration with authority, treasury, and min participation threshold. |\n| **Subject** | An entity that can be disputed (e.g., a listing, user, content). Tied to a specific namespace. **Only namespace authority can create subjects.** |\n| **Dispute** | A challenge against a subject. Goes through voting and resolution phases. |\n| **Pools** | User stake pools (Defender, Challenger, Juror) are global and can participate across namespaces. |\n\n### Access Control\n\n| Action | Who Can Do It |\n|--------|---------------|\n| Create Subject | **Namespace authority only** |\n| Add Defender Bond | Anyone |\n| Create Dispute / Join Challengers | Anyone |\n| Vote | Anyone with Juror Pool |\n| Claim Rewards | Participants only |\n\n---\n\n## Step 1: Initialize Your Namespace\n\nEach platform must initialize their own namespace before creating subjects.\n\n```typescript\nimport { ScaleCraftClient } from \"@craftec/scalecraft-sdk\";\nimport { Connection, Keypair } from \"@solana/web3.js\";\nimport { Wallet, BN } from \"@coral-xyz/anchor\";\n\n// Setup connection and wallet\nconst connection = new Connection(\"https://api.devnet.solana.com\");\nconst platformKeypair = Keypair.fromSecretKey(/* your platform keypair */);\nconst wallet = new Wallet(platformKeypair);\n\nconst client = new ScaleCraftClient({ connection, wallet });\n\n// Initialize your namespace (one-time setup)\nconst NAMESPACE = \"myplatform\"; // Choose a unique namespace\nconst MIN_PARTICIPATION = new BN(0); // Minimum stake required (0 = no minimum)\n\nconst result = await client.initializeConfig(NAMESPACE, MIN_PARTICIPATION);\nconsole.log(\"Config PDA:\", result.accounts.protocolConfig.toBase58());\n```\n\n**Important**: Namespaces are globally unique. Once claimed, no other platform can use the same namespace.\n\n---\n\n## Step 2: Create Subjects\n\nSubjects are entities that can be disputed. They're tied to your namespace.\n\n**Important**: Only the namespace authority can create subjects. This should be done from your backend server that holds the authority keypair.\n\n```typescript\nimport { Keypair } from \"@solana/web3.js\";\nimport { BN } from \"@coral-xyz/anchor\";\n\n// Must be signed by namespace authority wallet\n// Generate a unique subject ID (or use your own identifier)\nconst subjectId = Keypair.generate().publicKey;\n\n// Create a subject with defender bond\nawait client.createSubject({\n  namespace: NAMESPACE,\n  subjectId,\n  detailsCid: \"QmYourIPFSHash\", // IPFS hash with subject metadata\n  maxBond: new BN(10_000_000_000), // 10 SOL max bond\n  matchMode: true, // Challengers must match defender bond\n  votingPeriod: new BN(7 * 24 * 60 * 60), // 7 days voting period\n  bond: new BN(100_000_000), // 0.1 SOL initial bond\n});\n```\n\n### Subject with Pool Bond\n\nDefenders can also bond from their pool instead of directly:\n\n```typescript\n// First, create a defender pool\nawait client.createDefenderPool(new BN(1_000_000_000)); // 1 SOL\n\n// Create subject using pool bond\nawait client.createSubjectFromPool({\n  namespace: NAMESPACE,\n  subjectId,\n  detailsCid: \"QmYourIPFSHash\",\n  maxBond: new BN(10_000_000_000),\n  matchMode: true,\n  votingPeriod: new BN(7 * 24 * 60 * 60),\n  bond: new BN(100_000_000),\n});\n```\n\n---\n\n## Step 3: Dispute Flow\n\n### 3.1 Create a Dispute\n\nAny user can challenge a subject by creating a dispute:\n\n```typescript\n// Fetch the subject first\nconst subject = await client.fetchSubjectById(subjectId);\n\nawait client.createDispute({\n  subjectId,\n  disputeType: DisputeTypeEnum.Fraud, // See DisputeTypeEnum for options\n  detailsCid: \"QmDisputeEvidenceHash\",\n  stake: new BN(100_000_000), // Stake amount\n});\n```\n\n### 3.2 Join as Additional Challenger\n\nOther users can join an existing dispute:\n\n```typescript\nawait client.joinChallengers({\n  subjectId,\n  stake: new BN(50_000_000),\n  detailsCid: \"QmAdditionalEvidenceHash\",\n});\n```\n\n### 3.3 Defenders Add Bond\n\nDefenders can add more bond to protect the subject:\n\n```typescript\n// Direct bond\nawait client.addBondDirect({\n  subjectId,\n  bond: new BN(100_000_000),\n});\n\n// Or from pool\nawait client.addBondFromPool({\n  subjectId,\n  bond: new BN(100_000_000),\n});\n```\n\n### 3.4 Juror Voting\n\nJurors stake and vote on disputes:\n\n```typescript\n// First, create a juror pool\nawait client.createJurorPool(new BN(500_000_000)); // 0.5 SOL\n\n// Vote on the dispute\nawait client.vote({\n  subjectId,\n  choice: VoteChoiceEnum.ForChallenger, // or ForDefender\n  stakeAllocation: new BN(100_000_000),\n  rationaleCid: \"QmVoteRationaleHash\",\n});\n```\n\n### 3.5 Resolve Dispute\n\nAfter the voting period ends:\n\n```typescript\nawait client.resolveDispute({ subjectId });\n```\n\n---\n\n## Step 4: Claim Rewards\n\nAfter resolution, participants claim their rewards:\n\n```typescript\n// Claim juror reward (winning side only)\nawait client.claimJurorReward({ subjectId, round: 1 });\n\n// Claim challenger reward (if challenger wins)\nawait client.claimChallengerReward({ subjectId, round: 1 });\n\n// Claim defender reward (if defender wins)\nawait client.claimDefenderReward({ subjectId, round: 1 });\n```\n\n---\n\n## Step 5: Restoration (Re-validating Invalid Subjects)\n\nIf a subject was marked invalid, it can be restored:\n\n```typescript\n// Initiate restoration\nawait client.initiateRestore({\n  subjectId,\n  stake: new BN(200_000_000),\n  detailsCid: \"QmRestorationEvidenceHash\",\n});\n\n// Jurors vote on restoration\nawait client.voteRestore({\n  subjectId,\n  choice: RestoreVoteChoiceEnum.ForRestoration,\n  stakeAllocation: new BN(100_000_000),\n  rationaleCid: \"QmRestoreVoteRationale\",\n});\n\n// Resolve restoration\nawait client.resolveDispute({ subjectId });\n```\n\n---\n\n## Fetching Data\n\n### Fetch Protocol Config\n\n```typescript\nconst config = await client.fetchProtocolConfig(NAMESPACE);\nconsole.log(\"Authority:\", config.authority.toBase58());\nconsole.log(\"Treasury:\", config.treasury.toBase58());\nconsole.log(\"Min Participation:\", config.minParticipation.toString());\n```\n\n### Fetch Subjects\n\n```typescript\n// By subject ID\nconst subject = await client.fetchSubjectById(subjectId);\n\n// All subjects (filter by config in your app)\nconst allSubjects = await client.fetchAllSubjects();\nconst mySubjects = allSubjects.filter(s =>\n  s.account.config.equals(myConfigPda)\n);\n```\n\n### Fetch Disputes and Records\n\n```typescript\n// Fetch dispute for a subject\nconst dispute = await client.fetchDisputeBySubjectId(subjectId);\n\n// Fetch user records\nconst defenderRecord = await client.fetchDefenderRecord(subjectId, walletPubkey, round);\nconst challengerRecord = await client.fetchChallengerRecord(subjectId, walletPubkey, round);\nconst jurorRecord = await client.fetchJurorRecord(subjectId, walletPubkey, round);\n```\n\n### Fetch Pools\n\n```typescript\nconst defenderPool = await client.fetchDefenderPool(walletPubkey);\nconst challengerPool = await client.fetchChallengerPool(walletPubkey);\nconst jurorPool = await client.fetchJurorPool(walletPubkey);\n```\n\n---\n\n## PDA Derivation\n\nUse the PDA helper for address derivation:\n\n```typescript\nimport { pda } from \"@craftec/scalecraft-sdk\";\n\n// Protocol Config PDA (includes namespace)\nconst [configPda] = pda.protocolConfig(\"myplatform\");\n\n// Pool PDAs (global, per user)\nconst [defenderPool] = pda.defenderPool(walletPubkey);\nconst [challengerPool] = pda.challengerPool(walletPubkey);\nconst [jurorPool] = pda.jurorPool(walletPubkey);\n\n// Subject PDAs\nconst [subjectPda] = pda.subject(subjectId);\nconst [disputePda] = pda.dispute(subjectId);\nconst [escrowPda] = pda.escrow(subjectId);\n\n// Round-specific Record PDAs\nconst [defenderRecord] = pda.defenderRecord(subjectId, walletPubkey, round);\nconst [challengerRecord] = pda.challengerRecord(subjectId, walletPubkey, round);\nconst [jurorRecord] = pda.jurorRecord(subjectId, walletPubkey, round);\n```\n\n---\n\n## Type Helpers\n\n```typescript\nimport {\n  // Status checks\n  isSubjectDormant,\n  isSubjectValid,\n  isSubjectDisputed,\n  isSubjectInvalid,\n  isSubjectRestoring,\n  isDisputePending,\n  isDisputeResolved,\n  isChallengerWins,\n  isDefenderWins,\n  isNoParticipation,\n\n  // Display names\n  getDisputeTypeName,\n  getOutcomeName,\n  getBondSourceName,\n} from \"@craftec/scalecraft-sdk\";\n\n// Example usage\nif (isSubjectDisputed(subject.status)) {\n  const dispute = await client.fetchDisputeBySubjectId(subjectId);\n  if (isDisputeResolved(dispute.status)) {\n    console.log(\"Outcome:\", getOutcomeName(dispute.outcome));\n  }\n}\n```\n\n---\n\n## Enums\n\n```typescript\nimport {\n  DisputeTypeEnum,\n  VoteChoiceEnum,\n  RestoreVoteChoiceEnum,\n  BondSourceEnum,\n  SubjectStatusEnum,\n  DisputeStatusEnum,\n  ResolutionOutcomeEnum,\n} from \"@craftec/scalecraft-sdk\";\n\n// Dispute types\nDisputeTypeEnum.Other\nDisputeTypeEnum.Breach\nDisputeTypeEnum.Fraud\nDisputeTypeEnum.QualityDispute\nDisputeTypeEnum.NonDelivery\nDisputeTypeEnum.Misrepresentation\nDisputeTypeEnum.PolicyViolation\nDisputeTypeEnum.DamagesClaim\n\n// Vote choices\nVoteChoiceEnum.ForChallenger\nVoteChoiceEnum.ForDefender\n\n// Restore vote choices\nRestoreVoteChoiceEnum.ForRestoration\nRestoreVoteChoiceEnum.AgainstRestoration\n```\n\n---\n\n## Constants\n\n```typescript\nimport { PROGRAM_ID } from \"@craftec/scalecraft-sdk\";\n\nconsole.log(\"Program ID:\", PROGRAM_ID.toBase58());\n// Devnet: YxF3CEwUr5Nhk8FjzZDhKFcSHfgRHYA31Ccm3vd2Mrz\n```\n\n---\n\n## Complete Integration Example\n\n```typescript\nimport { ScaleCraftClient, DisputeTypeEnum, VoteChoiceEnum } from \"@craftec/scalecraft-sdk\";\nimport { Connection, Keypair } from \"@solana/web3.js\";\nimport { Wallet, BN } from \"@coral-xyz/anchor\";\n\nasync function main() {\n  // 1. Setup\n  const connection = new Connection(\"https://api.devnet.solana.com\");\n  const wallet = new Wallet(Keypair.generate());\n  const client = new ScaleCraftClient({ connection, wallet });\n\n  const NAMESPACE = \"myplatform\";\n\n  // 2. Initialize namespace (one-time)\n  await client.initializeConfig(NAMESPACE, new BN(0));\n\n  // 3. Create a subject\n  const subjectId = Keypair.generate().publicKey;\n  await client.createSubject({\n    namespace: NAMESPACE,\n    subjectId,\n    detailsCid: \"QmSubjectDetails\",\n    maxBond: new BN(10_000_000_000),\n    matchMode: true,\n    votingPeriod: new BN(604800), // 7 days\n    bond: new BN(100_000_000),\n  });\n\n  // 4. Someone disputes the subject\n  await client.createDispute({\n    subjectId,\n    disputeType: DisputeTypeEnum.Fraud,\n    detailsCid: \"QmDisputeEvidence\",\n    stake: new BN(100_000_000),\n  });\n\n  // 5. Jurors vote\n  await client.createJurorPool(new BN(500_000_000));\n  await client.vote({\n    subjectId,\n    choice: VoteChoiceEnum.ForChallenger,\n    stakeAllocation: new BN(100_000_000),\n    rationaleCid: \"QmVoteRationale\",\n  });\n\n  // 6. After voting period, resolve\n  await client.resolveDispute({ subjectId });\n\n  // 7. Claim rewards\n  await client.claimJurorReward({ subjectId, round: 1 });\n}\n```\n\n---\n\n## Requirements\n\n- Node.js >= 18.0.0\n- @solana/web3.js >= 1.90.0\n- @coral-xyz/anchor >= 0.30.0\n\n## Networks\n\n| Network | Program ID |\n|---------|------------|\n| Devnet | `YxF3CEwUr5Nhk8FjzZDhKFcSHfgRHYA31Ccm3vd2Mrz` |\n| Mainnet | TBD |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}