Skip to content

Commit 6c4c2ad

Browse files
committed
llms
1 parent 86d4d2e commit 6c4c2ad

File tree

7 files changed

+739
-834
lines changed

7 files changed

+739
-834
lines changed

.ai/categories/smart-contracts.md

Lines changed: 289 additions & 316 deletions
Large diffs are not rendered by default.

.ai/categories/tooling.md

Lines changed: 289 additions & 316 deletions
Large diffs are not rendered by default.

.ai/pages/smart-contracts-libraries-web3-js.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ Add the Solidity compiler so you can generate standard EVM bytecode:
7373
npm install --save-dev solc
7474
```
7575

76-
!!! tip
77-
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.
78-
7976
## Set Up the Web3 Provider
8077

8178
The provider configuration is the foundation of any Web3.js application. It serves as a bridge between your application and the blockchain, allowing you to query blockchain data and interact with smart contracts.
@@ -132,7 +129,7 @@ With the provider set up, you can start querying the blockchain. For instance, t
132129
const PROVIDER_RPC = {
133130
rpc: 'https://testnet-passet-hub-eth-rpc.polkadot.io',
134131
chainId: 420420422,
135-
name: 'polkadot-hub-testnet',
132+
name: 'polkadotTestNet',
136133
};
137134

138135
const main = async () => {
@@ -395,7 +392,7 @@ You can create a `deploy.js` script in the `scripts` directory of your project t
395392
const providerConfig = {
396393
rpc: 'https://testnet-passet-hub-eth-rpc.polkadot.io', // TODO: replace to `https://services.polkadothub-rpc.com/testnet` when ready
397394
chainId: 420420422,
398-
name: 'polkadot-hub-testnet',
395+
name: 'polkadotTestNet',
399396
};
400397

401398
const privateKey = 'INSERT_PRIVATE_KEY';
@@ -503,7 +500,7 @@ You can create a `deploy.js` script in the `scripts` directory of your project t
503500
const providerConfig = {
504501
rpc: 'https://testnet-passet-hub-eth-rpc.polkadot.io', // TODO: replace to `https://services.polkadothub-rpc.com/testnet` when ready
505502
chainId: 420420422,
506-
name: 'polkadot-hub-testnet',
503+
name: 'polkadotTestNet',
507504
};
508505

509506
const privateKey = 'INSERT_PRIVATE_KEY';
@@ -523,7 +520,7 @@ After running this script, your contract will be deployed to Polkadot Hub, and i
523520

524521
## Interact with the Contract
525522

526-
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 `scripts` directory of your project and add the following code:
523+
Once the contract is deployed, you can interact with it by calling its functions. For example, to read the current stored value and then update it to a new value, you can create a file named `updateStorage.js` in the `scripts` directory of your project and add the following code:
527524

528525
```js title="scripts/updateStorage.js"
529526
const { readFileSync } = require('fs');
@@ -593,7 +590,7 @@ updateStorage(config)
593590
.catch((error) => console.error('Update error'));
594591
```
595592

596-
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.
593+
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 reads the current stored value, sets it to 1, and then displays the updated value.
597594

598595
To interact with the contract, run:
599596

@@ -609,8 +606,8 @@ node scripts/updateStorage.js
609606

610607
---
611608

612-
Explore the Web3.js documentation to learn how to use additional features, such as wallet management, signing messages, subscribing to events, etc.
609+
Explore the Web3.js documentation to learn how to use additional features, such as wallet management, signing messages, subscribing to events, and more.
613610

614-
[:octicons-arrow-right-24: Get Started](https://web3js.readthedocs.io/en/v1.10.0/)
611+
[:octicons-arrow-right-24: Get Started](https://web3js.readthedocs.io/en/v1.10.0/){target=\_blank}
615612

616613
</div>

0 commit comments

Comments
 (0)