Skip to content

Conversation

@nhussein11
Copy link
Collaborator

πŸ“ Description

Provide a clear and concise description of your changes.

πŸ” Review Preference

Choose one:

  • βœ… I have time to handle formatting/style feedback myself
  • ⚑ Docs team handles formatting (check "Allow edits from maintainers")

πŸ€– AI-Ready Docs

If content changed, regenerate AI files:

  • βœ… I ran python3 scripts/generate_llms.py
  • ⚑ Docs team will regenerate (check "Allow edits from maintainers")

βœ… Checklist

@nhussein11 nhussein11 self-assigned this Nov 17, 2025
@nhussein11 nhussein11 requested a review from a team as a code owner November 17, 2025 22:06
Copilot AI review requested due to automatic review settings November 17, 2025 22:06
Copilot finished reviewing on behalf of nhussein11 November 17, 2025 22:10
Copy link
Contributor

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 PR refactors the Web3.js documentation to migrate from PolkaVM-specific compilation (using @parity/resolc) to standard EVM compilation (using solc). The changes align Web3.js usage with standard Ethereum tooling while maintaining compatibility with Polkadot Hub's Ethereum RPC endpoint.

Key changes:

  • Replaced PolkaVM compilation workflow with standard EVM/solc compilation
  • Updated project structure to use .bin files instead of .polkavm files
  • Modified deployment and interaction scripts to work with EVM bytecode
  • Enhanced documentation with step-by-step deployment instructions

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
smart-contracts/libraries/web3-js.md Main documentation updated to reflect EVM compilation approach and improved tutorial structure
llms.txt Updated page title and description to match new content focus
llms-full.jsonl Regenerated AI training data with updated Web3.js documentation content
.snippets/code/smart-contracts/libraries/web3-js/compile.js Replaced resolc compiler with solc for standard EVM bytecode generation
.snippets/code/smart-contracts/libraries/web3-js/deploy.js Updated to read .bin files and use CommonJS module syntax
.snippets/code/smart-contracts/libraries/web3-js/updateStorage.js Refactored to use CommonJS and updated file path handling
.ai/site-index.json Updated metadata including title, preview text, and outline structure
.ai/pages/smart-contracts-libraries-web3-js.md Regenerated AI-friendly page with complete updated documentation
.ai/categories/tooling.md Added full Web3.js content to tooling category index
.ai/categories/smart-contracts.md Added full Web3.js content to smart contracts category index

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

```

To execute the logic above, run:
Ensure you replace the `INSERT_MNEMONIC`, `INSERT_CONTRACT_ADDRESS`, and `INSERT_ADDRESS_TO_CHECK` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the balance for `ADDRESS_TO_CHECK` before it writes and doubles the stored value, so pick any account you want to monitor.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions placeholders INSERT_MNEMONIC and INSERT_ADDRESS_TO_CHECK, but the actual updateStorage.js code only contains INSERT_PRIVATE_KEY and INSERT_CONTRACT_ADDRESS. The documentation also incorrectly states "The script prints the balance for ADDRESS_TO_CHECK before it writes and doubles the stored value" - but the script actually sets the value to 1 (not doubling it) and doesn't print any balance. This description appears to be copied from a different example and doesn't match the actual code.

Suggested change
Ensure you replace the `INSERT_MNEMONIC`, `INSERT_CONTRACT_ADDRESS`, and `INSERT_ADDRESS_TO_CHECK` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the balance for `ADDRESS_TO_CHECK` before it writes and doubles the stored value, so pick any account you want to monitor.
Ensure you replace the `INSERT_PRIVATE_KEY` and `INSERT_CONTRACT_ADDRESS` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script sets the stored value to 1; you can modify the script to change this value as needed.

Copilot uses AI. Check for mistakes.
## Interact with the Contract

Once deployed, you can interact with your contract using Web3.js methods. Here's how to set a number and read it back, ensure replacing `INSERT_RPC_URL`, `INSERT_PRIVATE_KEY`, and `INSERT_CONTRACT_ADDRESS` with the appropriate values:
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description says "to set a number, read it and then modify that number by its double" but the actual code sets the number to a fixed value of 1 (line 33), not doubling the current value. The documentation should accurately describe what the code does: "to set a number to 1 and read back the stored value".

Suggested change
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number to 1 and read back the stored value, you can create a file named `updateStorage.js` in the root of your project and add the following code:

Copilot uses AI. Check for mistakes.
privateKey: 'INSERT_PRIVATE_KEY',
contractName: 'INSERT_CONTRACT_NAME',
const providerConfig = {
rpc: 'https://testnet-passet-hub-eth-rpc.polkadot.io', // TODO: replace to `https://services.polkadothub-rpc.com/testnet` when ready
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO comment suggests replacing the RPC URL with https://services.polkadothub-rpc.com/testnet when ready. If this is a permanent TODO that developers should be aware of, it should be documented. If the current URL is the correct one to use, the TODO should be removed.

Suggested change
rpc: 'https://testnet-passet-hub-eth-rpc.polkadot.io', // TODO: replace to `https://services.polkadothub-rpc.com/testnet` when ready
rpc: 'https://services.polkadothub-rpc.com/testnet',

Copilot uses AI. Check for mistakes.
## Interact with the Contract

Once deployed, you can interact with your contract using Web3.js methods. Here's how to set a number and read it back, ensure replacing `INSERT_RPC_URL`, `INSERT_PRIVATE_KEY`, and `INSERT_CONTRACT_ADDRESS` with the appropriate values:
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description says "to set a number, read it and then modify that number by its double" but the actual code sets the number to a fixed value of 1, not doubling the current value. The documentation should accurately describe what the code does: "to set a number to 1 and read back the stored value".

Suggested change
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Once the contract is deployed, you can interact with it by calling its functions. For example, to set the stored number to `1` and read back the stored value, you can create a file named `updateStorage.js` in the root of your project and add the following code:

Copilot uses AI. Check for mistakes.

## Interact with the Contract

Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description says "to set a number, read it and then modify that number by its double" but the actual code sets the number to a fixed value of 1, not doubling the current value. The documentation should accurately describe what the code does: "to set a number to 1 and read back the stored value".

Suggested change
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number to 1 and read back the stored value, you can create a file named `updateStorage.js` in the root of your project and add the following code:

Copilot uses AI. Check for mistakes.
.catch((error) => console.error('Update error'));
```

Ensure you replace the `INSERT_MNEMONIC`, `INSERT_CONTRACT_ADDRESS`, and `INSERT_ADDRESS_TO_CHECK` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the balance for `ADDRESS_TO_CHECK` before it writes and doubles the stored value, so pick any account you want to monitor.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions placeholders INSERT_MNEMONIC and INSERT_ADDRESS_TO_CHECK, but the actual updateStorage.js code only contains INSERT_PRIVATE_KEY and INSERT_CONTRACT_ADDRESS. The documentation also incorrectly states "The script prints the balance for ADDRESS_TO_CHECK before it writes and doubles the stored value" - but the script actually sets the value to 1 (not doubling it) and doesn't print any balance. This description appears to be copied from a different example and doesn't match the actual code.

Suggested change
Ensure you replace the `INSERT_MNEMONIC`, `INSERT_CONTRACT_ADDRESS`, and `INSERT_ADDRESS_TO_CHECK` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the balance for `ADDRESS_TO_CHECK` before it writes and doubles the stored value, so pick any account you want to monitor.
Ensure you replace the `INSERT_PRIVATE_KEY` and `INSERT_CONTRACT_ADDRESS` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the current stored value, sets it to 1, and then prints the new stored value.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +77
!!! tip
The sample scripts use ECMAScript modules. Add `"type": "module"` to your `package.json` (or rename the files to `.mjs`) so that `node` can run the `import` statements.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that "The sample scripts use ECMAScript modules" but the actual code snippets use CommonJS (require, module.exports). This is inconsistent. Either the tip should state the scripts use CommonJS, or the scripts should be updated to use ES modules with import statements.

Copilot uses AI. Check for mistakes.
Comment on lines +3055 to +3056
!!! tip
The sample scripts use ECMAScript modules. Add `"type": "module"` to your `package.json` (or rename the files to `.mjs`) so that `node` can run the `import` statements.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that "The sample scripts use ECMAScript modules" but the actual code snippets use CommonJS (require, module.exports). This is inconsistent. Either the tip should state the scripts use CommonJS, or the scripts should be updated to use ES modules with import statements.

Copilot uses AI. Check for mistakes.
| [ETH Native](/smart-contracts/precompiles/eth-native/){target=\_blank} | EVM precompiles and interfaces |
| [Staking](/smart-contracts/precompiles/staking/){target=\_blank} | Interact with staking functionality via precompiles |
| [XCM](/smart-contracts/precompiles/xcm/){target=\_blank} | Cross‑chain messaging helpers for contracts |
Ensure you replace the `INSERT_MNEMONIC`, `INSERT_CONTRACT_ADDRESS`, and `INSERT_ADDRESS_TO_CHECK` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the balance for `ADDRESS_TO_CHECK` before it writes and doubles the stored value, so pick any account you want to monitor.
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation mentions placeholders INSERT_MNEMONIC and INSERT_ADDRESS_TO_CHECK, but the actual updateStorage.js code only contains INSERT_PRIVATE_KEY and INSERT_CONTRACT_ADDRESS. The documentation also incorrectly states "The script prints the balance for ADDRESS_TO_CHECK before it writes and doubles the stored value" - but the script actually sets the value to 1 (not doubling it) and doesn't print any balance. This description appears to be copied from a different example and doesn't match the actual code.

Suggested change
Ensure you replace the `INSERT_MNEMONIC`, `INSERT_CONTRACT_ADDRESS`, and `INSERT_ADDRESS_TO_CHECK` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the balance for `ADDRESS_TO_CHECK` before it writes and doubles the stored value, so pick any account you want to monitor.
Ensure you replace the `INSERT_PRIVATE_KEY` and `INSERT_CONTRACT_ADDRESS` placeholders with actual values. Also, ensure the contract ABI file (`Storage.json`) is correctly referenced. The script prints the current stored value, sets it to 1, and then prints the new stored value.

Copilot uses AI. Check for mistakes.

## Ethereum Developer Resources
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description says "to set a number, read it and then modify that number by its double" but the actual code sets the number to a fixed value of 1, not doubling the current value. The documentation should accurately describe what the code does: "to set a number to 1 and read back the stored value".

Suggested change
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number, read it and then modify that number by its double, you can create a file named `updateStorage.js` in the root of your project and add the following code:
Once the contract is deployed, you can interact with it by calling its functions. For example, to set a number to 1 and read back the stored value, you can create a file named `updateStorage.js` in the root of your project and add the following code:

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

None yet

Development

Successfully merging this pull request may close these issues.

4 participants