Skip to content

Conversation

@nk4dev
Copy link
Owner

@nk4dev nk4dev commented Dec 12, 2025

current commit .

4b282ce

nk4dev added 12 commits November 6, 2025 11:40
…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
@nk4dev nk4dev added this to the SDK milestone Dec 12, 2025
@nk4dev nk4dev requested a review from Copilot December 12, 2025 01:14
@nk4dev nk4dev self-assigned this Dec 12, 2025
@nk4dev nk4dev added this to vx3 Dec 12, 2025
Copy link

Copilot AI left a 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/vx to vx3 (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 = '' }) {
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
const parsed = JSON.parse(raw);
return Array.isArray(parsed) ? parsed : [parsed];
} catch (err) {
console.error(`Error reading vx.config.json: ${err.message}`);
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +340 to +359
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);
};
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
"type": "rpc"
},
{
// Example IPFS gateway entry. Either provide a gateway URL or an api object.
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
}
process.exit(0);
} catch (err) {
console.error(`IPFS fetch error: ${err.message}`);
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
const buf = new Uint8Array(await res.arrayBuffer());
return buf;
} catch (err) {
throw new Error(`Failed to fetch from gateway ${gatewayUrl}: ${err.message}`);
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
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>
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
maxPriorityFeePerGas?: string; // gwei as string
maxFeePerGas?: string; // gwei as string
gasLimit?: number;

Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +401 to 404
req.on('close', () => {
const idx = sseClients.indexOf(res);
if (idx >= 0) sseClients.splice(idx, 1);
});
Copy link

Copilot AI Dec 12, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +17
function setTimestamp(uint256 hash, uint256 timestamp) public {
require(hashToTimestamp[hash] == 0, "Timestamp already set");
hashToTimestamp[hash] = timestamp;
Copy link

Copilot AI Dec 12, 2025

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.

Suggested change
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;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants