-
Notifications
You must be signed in to change notification settings - Fork 0
marge dev branch to master #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…S integration - Updated `vx.config.json` to allow multiple RPC and IPFS entries. - Added commands for saving and adding IPFS configurations in the CLI. - Improved error handling and validation for RPC and IPFS configurations. - Enhanced the debug page to display available RPC endpoints and allow selection. - Fixed typos in function names for consistency. - Updated documentation in `readme-ja.md` to reflect new RPC settings. - Added tests for CLI help command to ensure output correctness.
update markdown content endpoint on llms.txt
add command test and status badge
delete sample sample case, fix jest.config.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request merges the development branch into master, introducing significant new features and improvements to the VX SDK. The changes include IPFS integration, enhanced developer experience with a real-time debug dashboard, improved documentation, and CI/CD workflow additions. However, there are several issues that should be addressed, including naming inconsistencies, package configuration concerns, and potential concurrency issues.
Key Changes:
- Added IPFS gateway support with new commands and configuration options
- Implemented Server-Sent Events (SSE) for real-time block updates in the debug dashboard
- Enhanced the development server with wallet connection and test payment features
- Reorganized project structure with new LLM-focused documentation
- Added GitHub Actions CI workflow for automated testing
- Changed package name from
@nk4dev/vxtovx3(breaking change)
Reviewed changes
Copilot reviewed 45 out of 51 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| vx.config.json | Added type field to support RPC/IPFS endpoint differentiation |
| test/cli.help.test.js | New test for CLI help command functionality |
| src/server/dev.ts | Major enhancements including SSE support, dynamic block updates, wallet integration, and payment testing UI |
| src/payment/index.ts | Added optional from field to payment options |
| src/libs/sign_project.ts | Fixed typo: renamed shellhaldler to shellHandler |
| src/core/rpc/manager.ts | Extended to support IPFS gateway configuration alongside RPC endpoints |
| src/core/rpc/config.ts | Added IPFS configuration examples |
| src/core/ipfs.ts | New module for IPFS content fetching via gateways |
| src/command/rpc.ts | Added save-ipfs and add-ipfs commands |
| src/command/main.ts | Fixed import naming and added IPFS command integration |
| src/command/ipfs.ts | New command handler for IPFS operations |
| src/command/input.ts | Fixed typo: renamed shellhaldler to shellHandler |
| sample.test.js | Removed obsolete test file |
| packages/template/vx.config.json | Updated with type field and IPFS example |
| packages/hardhat/* | Replaced Sample contract with FileTimestamp contract; updated configuration |
| package.json | Version bump to 0.0.19; package name changed to vx3; dependency reorganization |
| llms.txt | New file indexing LLM-focused documentation |
| jest.config.js | Added dist ignore pattern; changed to CommonJS export |
| docs/* | Added comprehensive LLM documentation (overview, installation, commands, usage) |
| README.md | Major documentation overhaul with detailed usage examples and structure |
| .gitignore | Added cache directory and yarn.lock |
| .github/workflows/ci.yml | New CI workflow for automated testing |
| .github/*.md | Added TypeScript, Copilot, and commit message instruction files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| function localWebViewBuilder({ blognum, host, port }) { | ||
| const rpc = getRpcUrl(); | ||
| function localWebViewBuilder({ blognum, host, port, rpcList = [], rpcUrl = '' }) { |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name 'blognum' is unclear and appears to be a typo. This should be renamed to 'blocknum' or 'blockNumber' to clearly indicate it represents a block number.
| const parsed = JSON.parse(raw); | ||
| return Array.isArray(parsed) ? parsed : [parsed]; | ||
| } catch (err) { | ||
| console.error(`Error reading vx.config.json: ${err.message}`); |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message concatenates the error with string interpolation incorrectly. The error message should use 'err' directly or ensure proper error handling, as 'err.message' may be undefined for non-Error objects.
| sseInterval = setInterval(async () => { | ||
| try { | ||
| const url = rpcUrl || getRpcUrl(); | ||
| if (!url) return; | ||
| const bn = await getBlockNumber(url); | ||
| if (typeof bn === 'number' && bn !== lastKnownBlock) { | ||
| lastKnownBlock = bn; | ||
| const payload = JSON.stringify({ blockNumber: bn }); | ||
| // send to all clients | ||
| sseClients.forEach((client) => { | ||
| try { | ||
| client.write(`event: block\ndata: ${payload}\n\n`); | ||
| } catch (e) { /* ignore per-client errors */ } | ||
| }); | ||
| } | ||
| } catch (err) { | ||
| // ignore interval errors | ||
| } | ||
| }, 2000); | ||
| }; |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SSE polling interval is set to 2000ms (2 seconds) and runs indefinitely. If the server is left running with multiple clients, this could lead to unnecessary blockchain queries and resource consumption. Consider implementing a mechanism to stop the interval when there are no active SSE clients, or increase the interval duration for production environments.
| "type": "rpc" | ||
| }, | ||
| { | ||
| // Example IPFS gateway entry. Either provide a gateway URL or an api object. |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline comment for the IPFS gateway entry should be formatted as a block comment (/** ... */) or moved to a separate line to maintain consistency with TypeScript/JavaScript documentation standards. Inline comments within JSON-like structures can be confusing.
| } | ||
| process.exit(0); | ||
| } catch (err) { | ||
| console.error(`IPFS fetch error: ${err.message}`); |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message concatenates the error with string interpolation incorrectly. The error message should use proper error handling, as 'err.message' may be undefined for non-Error objects.
| const buf = new Uint8Array(await res.arrayBuffer()); | ||
| return buf; | ||
| } catch (err) { | ||
| throw new Error(`Failed to fetch from gateway ${gatewayUrl}: ${err.message}`); |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message concatenates the error with string interpolation incorrectly. The error message should use proper error handling, as 'err.message' may be undefined for non-Error objects.
| and known caveats to help developers and automated agents get started quickly.</p> | ||
| <section id="information" class="information card"> | ||
| another Website / repository for vx: | ||
| <a href="https://github.com/nk4dev/vx">Main Repository of project</a> |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removed link to the vx-home repository appears to be outdated. Verify that removing this link is intentional and that users don't need access to this resource.
| maxPriorityFeePerGas?: string; // gwei as string | ||
| maxFeePerGas?: string; // gwei as string | ||
| gasLimit?: number; | ||
|
|
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line added without apparent purpose. Consider removing trailing whitespace to maintain code cleanliness.
| req.on('close', () => { | ||
| const idx = sseClients.indexOf(res); | ||
| if (idx >= 0) sseClients.splice(idx, 1); | ||
| }); |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SSE client cleanup in the 'close' event handler is not thread-safe. Multiple simultaneous disconnections could lead to race conditions when splicing the sseClients array. Consider using a Set or implementing proper synchronization.
| function setTimestamp(uint256 hash, uint256 timestamp) public { | ||
| require(hashToTimestamp[hash] == 0, "Timestamp already set"); | ||
| hashToTimestamp[hash] = timestamp; |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setTimestamp function trusts the caller-provided timestamp value instead of deriving it from block.timestamp, meaning any address can store an arbitrary timestamp for a given hash. A malicious user can backdate or otherwise forge file timestamps (e.g., setting a timestamp far in the past) and mislead any off-chain system that relies on this contract as an authoritative timestamping or notarization source. To preserve data integrity, have the contract compute the timestamp internally (e.g., using block.timestamp) and consider restricting who is allowed to register entries, rather than accepting arbitrary values from callers.
| function setTimestamp(uint256 hash, uint256 timestamp) public { | |
| require(hashToTimestamp[hash] == 0, "Timestamp already set"); | |
| hashToTimestamp[hash] = timestamp; | |
| function setTimestamp(uint256 hash) public { | |
| require(hashToTimestamp[hash] == 0, "Timestamp already set"); | |
| hashToTimestamp[hash] = block.timestamp; |
current commit .
4b282ce