-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into update-the-js-v5-page
- Loading branch information
Showing
13 changed files
with
316 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Platform Compatibility | ||
description: Platforms compatible with zksync-ethers v5 and v6 | ||
tags: ["compatibility", "ethers.js", "zksync"] | ||
--- | ||
|
||
`zksync-ethers` supports all modern browsers (Chrome, Edge, Firefox, Safari, etc.) & runtime | ||
environments (Node.js, React Native, Electron). | ||
|
||
## Ethers v5 compatibility | ||
|
||
- **Node.js**: v12.x and above. | ||
- **Browser**: All modern browsers (Chrome, Firefox, Safari, Edge). | ||
- **React Native**: Supported via `react-native-ethers`. | ||
- **Electron**: Standard configurations supported. | ||
- **TypeScript**: Included type definitions. | ||
|
||
## Ethers v6 compatibility | ||
|
||
- **Node.js**: v14.x and above | ||
- **Browser**: Optimized for all modern browsers. | ||
- **React Native**: Improved support via the latest `react-native-ethers`. | ||
- **Electron**: Enhanced integration for desktop applications. | ||
- **TypeScript**: Comprehensive type definitions for better developer experience. | ||
- **BigInt**: Required for certain functionalities in ethers v6. | ||
|
||
Both versions offer robust platform compatibility, ensuring seamless integration with ZKsync across different environments. | ||
|
||
::callout{icon="i-heroicons-light-bulb"} | ||
For more detailed information and specific configurations, refer to the [official zksync-ethers documentation](https://zksync.io/sdk/js/ethers). | ||
:: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
title: Overview | ||
description: An introduction to the ZKsync Python SDK and its features. | ||
tags: ["zksync", "python", "sdk", "overview"] | ||
--- | ||
|
||
## Concept | ||
|
||
Most existing SDKs work right away, but deploying smart contracts or using unique ZKsync features, like account | ||
abstraction, needs extra fields that Ethereum transactions don't have by default. | ||
|
||
To make it easy to use all ZKsync Era features, we created the `zksync2` Python SDK. This SDK has an interface similar | ||
to [web3.py](https://web3py.readthedocs.io/en/latest/index.html). In fact, `web3.py` is a peer dependency of our | ||
library. Most objects exported by `zksync2` inherit from `web3.py` objects and only change the fields that need adjustments. | ||
|
||
::callout{icon="i-heroicons-light-bulb"} | ||
Explore the [installation guide](https://github.com/zksync-sdk/zksync2-examples/tree/main/python) to get started with | ||
the ZKsync Python SDK. | ||
:: | ||
|
||
## Connecting to ZKsync Era | ||
|
||
Once you have all the necessary dependencies, connect to ZKsync Era using the operator node endpoint. | ||
|
||
```python | ||
from zksync2.module.module_builder import ZkSyncBuilder | ||
|
||
sdk = ZkSyncBuilder.build("https://sepolia.era.zksync.dev") | ||
``` | ||
|
||
Get the chain ID: | ||
|
||
```python | ||
chain_id = zk_web3.zksync.chain_id | ||
``` | ||
|
||
Get the block number: | ||
|
||
```python | ||
block_number = zk_web3.zksync.block_number | ||
``` | ||
|
||
Get the transaction by hash: | ||
|
||
```python | ||
transaction = zk_web3.zksync.eth_get_transaction_by_hash(hash) | ||
``` | ||
|
||
## Examples | ||
|
||
These examples show how to: | ||
|
||
1. [Deposit ETH and tokens from Ethereum into ZKsync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/01_deposit.py) | ||
2. [Transfer ETH and tokens on ZKsync Era](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/02_transfer.py) | ||
3. [Withdraw ETH and tokens from ZKsync Era to Ethereum](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/09_withdrawal.py) | ||
4. [Use paymaster to pay fees with tokens](https://github.com/zksync-sdk/zksync2-examples/blob/main/python/15_use_paymaster.py) | ||
|
||
You can find the full code for all examples in | ||
the [Python ZKsync SDK](https://github.com/zksync-sdk/zksync2-examples/tree/main/python). These examples are set up to | ||
work with `ZKsync Era` and `Sepolia` test networks. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: Why Python SDK | ||
description: Benefits and features of Python SDK for ZKsync Era. | ||
tags: ["zksync", "ethers", "sdk", "python"] | ||
--- | ||
|
||
### Easy integration | ||
|
||
The ZKsync Python SDK integrates seamlessly with your existing Python projects. Its interface is similar to the | ||
popular [web3.py](https://web3py.readthedocs.io/en/latest/index.html) library, making it easy for developers | ||
familiar with Ethereum development to get started quickly. | ||
|
||
### Comprehensive functionality | ||
|
||
The SDK gives you access to all the unique features of ZKsync Era, including: | ||
|
||
- **Account abstraction**: Deploy and manage smart contracts with extra fields that standard Ethereum transactions | ||
don't have. | ||
- **Optimized performance**: Benefit from ZKsync's scalability and speed improvements directly through the SDK. | ||
|
||
### Consistent API | ||
|
||
The SDK maintains a consistent API with `web3.py`, ensuring a smooth transition and reducing the learning curve. Most | ||
objects exported by `zksync2` inherit from `web3.py` objects, with only necessary modifications. | ||
|
||
### Strong community support | ||
|
||
As part of the ZKsync ecosystem, the Python SDK benefits from strong [community support](https://join.zksync.dev/) | ||
and regular updates. You can | ||
find extensive documentation, examples, and a helpful community ready to assist you. | ||
|
||
### Security and reliability | ||
|
||
The ZKsync Python SDK is built with security and reliability in mind. It leverages ZKsync’s robust infrastructure to | ||
ensure secure and reliable transactions and interactions with the blockchain. | ||
|
||
### Active development | ||
|
||
The SDK is actively developed and maintained by the ZKsync team. This ensures that you always have access to the | ||
latest features and improvements, keeping your projects up to date with the evolving blockchain landscape. | ||
|
||
::callout{icon="i-heroicons-light-bulb"} | ||
Explore the [Python SDK documentation](/sdk/python/quickstart/getting-started) to get started and take advantage of all the | ||
features and benefits it offers. | ||
:: |
41 changes: 41 additions & 0 deletions
41
content/sdk/30.python/00.quickstart/02.installation-python.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: Installation | ||
description: How to install and set up Python SDK for your project. | ||
tags: ["zksync", "installation", "setup", "python", "sdk"] | ||
--- | ||
|
||
## Prerequisites | ||
|
||
Make sure you have the following software installed on your system: | ||
|
||
- **Python**: Version 3.8 or higher. Download and install it from the [Python website](https://www.python.org/downloads/). | ||
- **Pip**: Version 23.1.2 or higher. Pip is the package installer for Python. Install it using the guide on the [Pip website](https://pip.pypa.io/en/stable/installation/). | ||
|
||
## Adding dependencies | ||
|
||
To add the ZKsync Era SDK to your project, follow these steps: | ||
|
||
1. **Open your terminal**: Use any terminal or command line interface you like. | ||
|
||
2. **Install the ZKsync Era SDK**: Run this command to install the SDK with pip: | ||
|
||
```shell | ||
pip install zksync2 | ||
``` | ||
|
||
## Verification | ||
|
||
Check if the installation was successful by importing the SDK in a Python script or an interactive Python session: | ||
|
||
```python | ||
import importlib.metadata | ||
|
||
zksync_version = importlib.metadata.version("zksync2") | ||
print("ZKsync SDK version:", zksync_version) | ||
``` | ||
|
||
You should see a response like: | ||
|
||
```sh | ||
ZKsync SDK version: 1.2.0 | ||
``` |
37 changes: 37 additions & 0 deletions
37
content/sdk/30.python/00.quickstart/03.platform-compatibility-python.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Platform Compatibility | ||
description: Platforms compatible with Python SDK | ||
tags: ["compatibility", "python", "zksync"] | ||
--- | ||
|
||
The ZKsync Python SDK supports various platforms to ensure smooth integration and functionality. Here are the details: | ||
|
||
## Compatible platforms | ||
|
||
### Operating systems | ||
|
||
- **Windows**: Fully supported on Windows 10 and later versions. | ||
- **macOS**: Fully supported on macOS 10.15 (Catalina) and later versions. | ||
- **Linux**: Compatible with major distributions like Ubuntu, Debian, Fedora, and CentOS. | ||
|
||
### Python versions | ||
|
||
- **Python 3.8**: Supported | ||
- **Python 3.9**: Supported | ||
- **Python 3.10**: Supported | ||
- **Python 3.11**: Supported | ||
|
||
### Development Environments | ||
|
||
- **IDEs**: Works well with popular Integrated Development Environments like PyCharm, VSCode, and Atom. | ||
- **Virtual environments**: Compatible with virtual environment tools like `venv` and `virtualenv`. | ||
|
||
### Additional dependencies | ||
|
||
The SDK relies on certain dependencies to ensure full functionality. Make sure you have these installed: | ||
|
||
- **web3.py**: A peer dependency required by `zksync2`. | ||
|
||
```shell | ||
pip install web3 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.