Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions CONTRIBUTIONS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## Guidelines for Pull Requests and Releases

_These guidelines are a work in progress and will be changed/updated as the project evolves._

This document provides some ground rules for contributors (including the maintainer(s) of
the project) about how to make, review and publish changes. The most basic requirement is
that **Web3 not break**.
that **this should not break**.

### Pull Requests for substantive changes (e.g. everything except comments and docs)

Expand Down Expand Up @@ -45,7 +47,3 @@ Read more in [Release Guidelines](./RELEASE.md).
### Emergencies

Emergency releases are allowed to shorten waiting periods depending on the severity of the issue.

There is precedent set for this in the 1.2.6 release (see [#3351](https://github.com/ethereum/web3.js/pull/3351)), where the consensus view was to make the smallest change necessary to address the emergency while waiving the `rc` process (meaning many existing additions to master were excluded).

This topic is under further org-wide discussion at [ethereum/js-organization#6](https://github.com/ethereum/js-organization/issues/6).
54 changes: 28 additions & 26 deletions README.md

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# web3.js Release Guidelines
# @theqrl/web3.js Release Guidelines

_This document has not yet been fully ported from the original web3.js repository. It is a work in progress and will be updated in the future._

## Version Number Definition

The web3.js project follows the [semver 2.0.0 specification](https://semver.org/).
The @theqrl/web3.js project follows the [semver 2.0.0 specification](https://semver.org/).

### Major

Expand Down Expand Up @@ -44,7 +46,7 @@ Further details about versioning can be found in the [semver 2.0.0 specification
8. `git tag bumped-version`: Tag the commit with bumped version having prefix `v` , e.g. `git tag v4.0.1-alpha.0`
9. `git push origin release/bumped-version`: Push release branch to `origin`
10. `git push origin --tags`: Push release tag created in `Step 8` to `origin`
11. Create a draft release on Github similar to [this](https://github.com/ChainSafe/web3.js/releases/tag/web3-providers-base%401.0.0-alpha.1)
11. Create a draft release on Github similar to [this Chainsafe example](https://github.com/chainsafe/web3.js/releases/tag/web3-providers-base%401.0.0-alpha.1)
- Check `This is a pre-release`
- In the release description, copy all entries in `CHANGELOG.md` for the version being released
12. Click `Save draft`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This will give your plugin access to [requestManager](/api/web3-core/class/Web3C
:::caution

```ts
import { Web3PluginBase } from 'web3';
import { Web3PluginBase } from '@theqrl/web3';

export default class CustomRpcMethodsPlugin extends Web3PluginBase {
// step 1
Expand All @@ -35,7 +35,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase {
2. After that add public `pluginNamespace` property. This will be used to access your plugin, as mentioned in step number 5 code example.

```ts
import { Web3PluginBase } from 'web3';
import { Web3PluginBase } from '@theqrl/web3';

export default class CustomRpcMethodsPlugin extends Web3PluginBase {
public pluginNamespace = 'customRpcMethods'; // step 2
Expand All @@ -45,7 +45,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase {
3. Once plugin class is created using above mentioned steps, its very easy to add new RPC methods like:

```ts
import { Web3PluginBase } from 'web3';
import { Web3PluginBase } from '@theqrl/web3';

export default class CustomRpcMethodsPlugin extends Web3PluginBase {
public pluginNamespace = 'customRpcMethods';
Expand All @@ -64,7 +64,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase {
4. Final step is setting up module [augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation), this will allow you to access plugin on web3 object.

```ts
import { Web3PluginBase } from 'web3';
import { Web3PluginBase } from '@theqrl/web3';

export default class CustomRpcMethodsPlugin extends Web3PluginBase {
public pluginNamespace = 'customRpcMethods';
Expand All @@ -79,7 +79,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase {
}

// Module Augmentation
declare module 'web3' {
declare module '@theqrl/web3' {
// step 4

interface Web3Context {
Expand All @@ -99,8 +99,8 @@ After the plugin is ready, it is recommended to publish it on the NPM registry.
Once plugin is registered its custom methods will be available to use.

```ts
import { Web3 } from 'web3';
import CustomRpcMethodsPlugin from 'web3-plugin-example';
import { Web3 } from '@theqrl/web3';
import CustomRpcMethodsPlugin from '@theqrl/web3-plugin-example';

const web3 = new Web3('http://127.0.0.1:8545');
web3.registerPlugin(new CustomRpcMethodsPlugin()); // step 5
Expand All @@ -112,6 +112,6 @@ web3.customRpcMethods.customRpcMethod();

For more details follow :

- [Example Plugin Code](https://github.com/web3/web3.js/tree/4.x/tools/web3-plugin-example)
- [Example Plugin Code](https://github.com/theqrl/web3.js/tree/main/tools/web3-plugin-example)
- [Web3 Plugin developers Guide](/guides/web3_plugin_guide/plugin_authors)
- [Web3 Plugin Users Guide](/guides/web3_plugin_guide/plugin_users)
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ For further information about `sideEffects` see [webpack docs](https://webpack.j
import Web3Zond from '@theqrl/web3-zond';
```

If you only need a few functions from `web3-utils`:
If you only need a few functions from `@theqrl/web3-utils`:

```ts
import { numberToHex, hexToNumber } from 'web3-utils';
import { numberToHex, hexToNumber } from '@theqrl/web3-utils';
```

You can find an example app with tree shaking [here](https://github.com/ChainSafe/web3js-example-react-app).
4 changes: 2 additions & 2 deletions docs/docs/guides/basics/sign_and_send_tx/local_wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The simplest way to sign and send transactions is using a local wallet:

```ts
// First step: initialize `web3` instance
import Web3 from 'web3';
import Web3 from '@theqrl/web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: add an account to wallet
Expand Down Expand Up @@ -45,7 +45,7 @@ List of references:

```ts
// First step: initialize `web3` instance
import Web3 from 'web3';
import Web3 from '@theqrl/web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: add an account to wallet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If Zond node has unlocked account in its wallet you can send transaction without

```ts
// First step: initialize web3 instance
import Web3 from 'web3';
import Web3 from '@theqrl/web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: sign and send the transaction
Expand All @@ -37,7 +37,7 @@ List of references:

```ts
// First step: initialize web3 instance
import Web3 from 'web3';
import Web3 from '@theqrl/web3';
const web3 = new Web3(/* PROVIDER*/);

// Second step: sign and send the transaction
Expand Down
16 changes: 8 additions & 8 deletions docs/docs/guides/basics/zond.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Before we start writing and deploying our contract, we need to set up our enviro
First, create a new project directory for your project and navigate into it:

```
mkdir web3-eth-tutorial
cd web3-eth-tutorial
mkdir web3-zond-tutorial
cd web3-zond-tutorial
```

Next, initialize a new Node.js project using npm:
Expand All @@ -57,15 +57,15 @@ In this step, we will set up the web3.js library and connect to the Ganache netw
First, install the `web3` package using npm:

```
npm install @theqrl/web3@4.0.1-rc.1
npm install @theqrl/web3
```

Note that we are installing the latest version of 4.x, at the time of this tutorial writing. You can check the latest version at https://www.npmjs.com/package/@theqrl/web3?activeTab=versions

Next, create a new file called `index.ts` in your project directory and add the following code to it:

```javascript
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const { Web3 } = require('@theqrl/web3'); // web3.js has native ESM builds and (`import Web3 from '@theqrl/web3'`)

// Set up a connection to the Ganache network
const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'));
Expand Down Expand Up @@ -99,7 +99,7 @@ In the first example, we are going to send a simple value transaction.
Create a file named `transaction.ts` and fill it with the following code:

```typescript
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const { Web3 } = require('@theqrl/web3'); // web3.js has native ESM builds and (`import Web3 from '@theqrl/web3'`)
const fs = require('fs');
const path = require('path');

Expand Down Expand Up @@ -202,7 +202,7 @@ transactionHash {
In the next example, we are going to use `estimateGas` function to see the expected gas for contract deployment. (For more on contracts, please see the corresponding tutotial). Create a file named `estimate.ts` and fill it with the following code:

```typescript
import Web3, { ZOND_DATA_FORMAT, DEFAULT_RETURN_FORMAT } from 'web3';
import Web3, { ZOND_DATA_FORMAT, DEFAULT_RETURN_FORMAT } from '@theqrl/web3';

async function estimate() {
// abi of our contract
Expand Down Expand Up @@ -284,7 +284,7 @@ If everything is working correctly, you should see something like the following:
In the next example we are going to sign a transaction and use `sendSignedTransaction` to send the signed transaction. Create a file named `sendSigned.ts` and fill it with the following code:

```typescript
import Web3 from 'web3';
import Web3 from '@theqrl/web3';
const web3 = new Web3('http://localhost:7545');

//make sure to copy the private key from ganache
Expand Down Expand Up @@ -347,7 +347,7 @@ Transaction receipt: {

## Conclusion

In this tutorial, we learned how to use different methods provied by the `web3-eth` package.
In this tutorial, we learned how to use different methods provided by the `@theqrl/web3` package.

With this knowledge, you can start experimenting with the Zond blockchain. Keep in mind that this is just the beginning, and there is a lot more to learn about Zond and web3.js. So keep exploring and building, and have fun!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Note that we are installing the latest version of 4.x, at the time of this tutor
Next, create a new file called `index.js` in your project directory and add the following code to it:

```javascript
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const { Web3 } = require('@theqrl/web3'); // web3.js has native ESM builds and (`import Web3 from '@theqrl/web3'`)

// Set up a connection to the Ganache network
const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545'));
Expand Down Expand Up @@ -217,7 +217,7 @@ Create a file named `deploy.js` and fill it with the following code:
```javascript
// For simplicity we use `web3` package here. However, if you are concerned with the size,
// you may import individual packages like 'web3-zond', 'web3-zond-contract' and 'web3-providers-http'.
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const { Web3 } = require('@theqrl/web3'); // web3.js has native ESM builds and (`import Web3 from '@theqrl/web3'`)
const fs = require('fs');
const path = require('path');

Expand Down Expand Up @@ -293,7 +293,7 @@ In this step, we will use web3.js to interact with the smart contract on the Gan
Create a file named `interact.js` and fill it with the following code:

```javascript
const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`)
const { Web3 } = require('@theqrl/web3'); // web3.js has native ESM builds and (`import Web3 from '@theqrl/web3'`)
const fs = require('fs');
const path = require('path');

Expand Down Expand Up @@ -420,7 +420,7 @@ With this knowledge, you can start experimenting with writing smart contract in

## Additional Resources

- [Official web3.js Documentation](https://docs.web3js.org/)
- [Official web3.js Documentation](https://docs.theqrl.org/)
- [Hyperion Documentation](https://solidity.readthedocs.io/)
- [Ganache](https://www.trufflesuite.com/ganache)
- [Truffle](https://trufflesuite.com/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Before we dive into the problem, let's take a quick look at the problem. Web3.js
Web3.js uses ABI type to dynamically load available methods and events but Typescript currently [doesn't support loading JSON as const](https://github.com/microsoft/TypeScript/issues/32063). If you go to the [Playground Link](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgIwJYwLwwNoCga5gbxz1wCIkwAHAVyghIC5MjjdCWWywoBTAJzDgAbACoBPCtwYwS0XuQDmJADTN20gQFtJjEpu4B9ZavYko47dNkKSxvAF8VagreKce-IWIlSZUOWEVHJ3U4LR8IUQ0EEEFDIKdTc3C-axcYO1sAXXi8XzgeAFkaRCRBJDMfMHAKOFFEQUkc0jNvHVBIPypgKBBeG2IHVTYOOCqwSJAqOkYAMyEIbibpcmpaKWwnYYTyABNuAA9uHalOxbTScncBESSdOB2d3m4IOiXXPR8QAHcwPiNg6QtCwke6PZ50NKDTbnZZgPaHY6MU5vXKXPjXLzA0FPF7-YK6ULAiASOF-FHNW7SbHg-pqKFqLZqTjwo5SOaCBbk2FXTyUkhUS4AJgArAA2PEJD46ABuQiojRhiVa0gFXBF4shWSWBLCOgAghQKLwQLLBBLckCfNxpdwuLTcPTWLYQWMJlM2fMziYVjRpkxoQDmQdWUjePKuW50bzlSCHjjXoqpdIZsaNOaTJa7nGaZCUYzvaSEScw178WiPDcY9TcRGk6YQOmOJmqdncbm0vmOLtg4iYOzOYryxi+aqoOrG+9CT5TfKJxaR0KxfaWBl2NlnXXhLxRhAZmTnc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pBl1IQo8hbEoa13-g3E2ZtgF73btbQRECgJQM0awyBIi6r8K4SQFMIA0xGNjOTP8Qi87Ow4T4gxOgeiEOCfwimithE6PInTaJVI7KtTiUHL+Z8bLKN3HwAAYqmbOt8PGuK8aFPRZpfFxJMXI9aEMKGWL-ntdQmUm52LoQ40BTiHREEyPACAMB2jQAANxAA) and choose ".d.ts" you can check type difference with and without `as const`.

```typescript
import { Contract, Web3 } from 'web3';
import { Contract, Web3 } from '@theqrl/web3';
import ERC20 from './node_modules/@openzeppelin/contracts/build/contracts/ERC20.json';

(async function () {
Expand Down Expand Up @@ -100,7 +100,7 @@ and run the script with `node -r ts-node/register <script name>.ts <destination>
use those generated files in your code:

```typescript
import { Contract, ContractAbi, Web3 } from 'web3';
import { Contract, ContractAbi, Web3 } from '@theqrl/web3';
import ERC20 from './artifacts/ERC20';

(async function () {
Expand Down
Loading