lablab-ai-amd-developer-hackathon/proofbridge-liner-safety-kernel
1
1const fs = require('fs');2const path = require('path');3 4// Create a test state with sample deed text5const testState = {6 runAt: new Date().toISOString(),7 results: [8 {9 assetId: "0x52aa9c8c3e83a0f1f4f73b1f4d0f2c4a4b3a2d1c0e9d8c7b6a5948372615040f",10 ipfsCid: "bafybeiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354",11 expectedHash: "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",12 actualHash: "0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",13 status: "fresh",14 gateway: "https://ipfs.io/ipfs/",15 bytes: 1985,16 error: null,17 durationMs: 100,18 checkedAt: new Date().toISOString()19 }20 ],21 summary: {22 total: 1,23 fresh: 1,24 mismatch: 0,25 unreachable: 026 }27};28 29// Create test directory30const testDir = path.join(__dirname, 'test');31if (!fs.existsSync(testDir)) {32 fs.mkdirSync(testDir, { recursive: true });33}34 35// Write test state36const statePath = path.join(testDir, 'test-prover-state.json');37fs.writeFileSync(statePath, JSON.stringify(testState, null, 2));38 39// Create sample deed text file40const sampleDeedText = `PROPERTY DEED DOCUMENT41 42Property Address: 123 Blockchain Street, Crypto City, CC 1234543 44Legal Description:45This deed conveys all right, title, and interest in the real property located at 123 Blockchain Street, Crypto City, including all improvements thereon.46 47Grantor: RealT Property LLC48Grantee: Tokenized Real Estate Trust49 50Consideration: $100,000.0051 52This property is subject to the following encumbrances:53- First mortgage in the amount of $75,000.0054- Property taxes for 202455- HOA fees of $200.00 per month56 57Title Guarantee: The grantor warrants good title to the property, subject to the exceptions noted above.58 59Executed this 15th day of April, 2024.60 61[Signature]62John Doe, Authorized Representative63 64NOTARY PUBLIC65State of Michigan66County of Wayne67 68This document was acknowledged before me on April 15, 2024 by John Doe.69 70[Notary Seal]`;71 72const textPath = path.join(testDir, 'sample-deed-text.txt');73fs.writeFileSync(textPath, sampleDeedText);74 75console.log('โ
Test files created:');76console.log(`๐ State: ${statePath}`);77console.log(`๐ Text: ${textPath}`);78console.log(`๐ Sample text length: ${sampleDeedText.length} characters`);79 80// Test the auditor condition81const hasApiKey = process.env.NVIDIA_API_KEY && process.env.NVIDIA_API_KEY !== 'nvapi-your-key-here';82const hasText = sampleDeedText && sampleDeedText.length > 10 && !sampleDeedText.startsWith('[');83 84console.log(`๐ API Key available: ${hasApiKey ? 'โ
' : 'โ'}`);85console.log(`๐ Text extractable: ${hasText ? 'โ
' : 'โ'}`);86console.log(`๐ค AI analysis would run: ${hasApiKey && hasText ? 'โ
YES' : 'โ NO - ' + (!hasApiKey ? 'missing API key' : 'no text')}`);