From 383b1de8159f0a62eaa85cf046e8c855cacb80bd Mon Sep 17 00:00:00 2001 From: Ngozi Peace Okafor Date: Wed, 17 Jul 2024 09:13:45 +0100 Subject: [PATCH] feat: refactor the Java SDK (#72) * feat: refactor the Java SDK * fix: remove redundancy * fix: missing content * fix: update links * fix: minor update --- content/sdk/00.index.md | 8 +- .../02.api/00.providers/00.introduction.md | 2 +- .../{01.providers.md => 01.provider.md} | 2 +- content/sdk/40.java/00.getting-started.md | 80 ------------------- .../40.java/00.introduction/00.overview.md | 45 +++++++++++ .../00.introduction/01.why-java-sdk.md | 32 ++++++++ .../00.introduction/02.installation.md | 46 +++++++++++ .../40.java/01.guides/00.getting-started.md | 55 +++++++++++++ .../40.java/{ => 01.guides}/01.features.md | 10 ++- .../02.accounts-l1-l2.md} | 15 ++-- .../02.api/00.providers/00.introduction.md | 20 +++++ .../00.providers/01.provider.md} | 5 +- .../02.api/01.accounts/00.introduction.md | 32 ++++++++ .../01.accounts/01.wallet.md} | 31 +------ .../02.api/01.accounts/02.ethsigner.md | 29 +++++++ .../02.contract/00.contracts.md} | 6 +- .../03.utilities/00.utils.md} | 3 +- .../03.utilities/01.paymaster-utils.md} | 3 +- content/sdk/40.java/02.api/_dir.yml | 1 + .../sdk/40.java/{08.types.md => 04.types.md} | 5 +- 20 files changed, 297 insertions(+), 133 deletions(-) rename content/sdk/30.python/02.api/00.providers/{01.providers.md => 01.provider.md} (99%) delete mode 100644 content/sdk/40.java/00.getting-started.md create mode 100644 content/sdk/40.java/00.introduction/00.overview.md create mode 100644 content/sdk/40.java/00.introduction/01.why-java-sdk.md create mode 100644 content/sdk/40.java/00.introduction/02.installation.md create mode 100644 content/sdk/40.java/01.guides/00.getting-started.md rename content/sdk/40.java/{ => 01.guides}/01.features.md (73%) rename content/sdk/40.java/{04.accounts-l1-l2.md => 01.guides/02.accounts-l1-l2.md} (74%) create mode 100644 content/sdk/40.java/02.api/00.providers/00.introduction.md rename content/sdk/40.java/{02.providers.md => 02.api/00.providers/01.provider.md} (99%) create mode 100644 content/sdk/40.java/02.api/01.accounts/00.introduction.md rename content/sdk/40.java/{03.accounts.md => 02.api/01.accounts/01.wallet.md} (96%) create mode 100644 content/sdk/40.java/02.api/01.accounts/02.ethsigner.md rename content/sdk/40.java/{05.contracts.md => 02.api/02.contract/00.contracts.md} (67%) rename content/sdk/40.java/{06.utils.md => 02.api/03.utilities/00.utils.md} (98%) rename content/sdk/40.java/{07.paymaster-utils.md => 02.api/03.utilities/01.paymaster-utils.md} (92%) create mode 100644 content/sdk/40.java/02.api/_dir.yml rename content/sdk/40.java/{08.types.md => 04.types.md} (97%) diff --git a/content/sdk/00.index.md b/content/sdk/00.index.md index 9854ccc5..55f45cbd 100644 --- a/content/sdk/00.index.md +++ b/content/sdk/00.index.md @@ -34,11 +34,11 @@ These SDKs, available in various programming languages, streamline the process o - **Scalability**: Massively reduced transaction fees and faster confirmation times compared to Ethereum. - **Security**: Inherits security from the underlying Ethereum blockchain. -- **Enhanced User Experience**: Enables smoother and more cost-effective dApp interactions for users. -- **Paymaster Support**: Enables flexible transaction fee payment strategies: +- **Enhanced user experience**: Enables smoother and more cost-effective dApp interactions for users. +- **Paymaster support**: Enables flexible transaction fee payment strategies: - Third-party services can cover fees for users, fostering wider adoption. - Gasless transactions become possible, improving user experience. -- **Account Abstraction**: +- **Account abstraction**: - Enhances security and privacy by separating user accounts from keys. - Improves developer experience by simplifying account management and enabling features like multi-signature wallets and on-chain governance. @@ -82,7 +82,7 @@ Explore Nuxt built-in components for pages, layouts, head, and more. --- title: Java icon: i-heroicons-rectangle-group -to: /sdk/java/getting-started +to: /sdk/java/introduction/overview --- Integrate ZKsync Era with Java for cost-effective transactions. :: diff --git a/content/sdk/30.python/02.api/00.providers/00.introduction.md b/content/sdk/30.python/02.api/00.providers/00.introduction.md index f8d2d6d7..68b5f781 100644 --- a/content/sdk/30.python/02.api/00.providers/00.introduction.md +++ b/content/sdk/30.python/02.api/00.providers/00.introduction.md @@ -1,6 +1,6 @@ --- title: Introduction -description: Overview of Web3Providers and their functions. +description: Overview of Web3Providers and their functions tags: ["web3", "blockchain", "provider", "zksync"] --- diff --git a/content/sdk/30.python/02.api/00.providers/01.providers.md b/content/sdk/30.python/02.api/00.providers/01.provider.md similarity index 99% rename from content/sdk/30.python/02.api/00.providers/01.providers.md rename to content/sdk/30.python/02.api/00.providers/01.provider.md index e7549151..26fb4ca2 100644 --- a/content/sdk/30.python/02.api/00.providers/01.providers.md +++ b/content/sdk/30.python/02.api/00.providers/01.provider.md @@ -1,5 +1,5 @@ --- -title: Providers +title: Provider description: Web3Provider for ZKsync Python SDK tags: ["web3", "blockchain", "provider", "zksync"] --- diff --git a/content/sdk/40.java/00.getting-started.md b/content/sdk/40.java/00.getting-started.md deleted file mode 100644 index a20f6953..00000000 --- a/content/sdk/40.java/00.getting-started.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: Getting Started -description: ---- - -This is a short introduction to `zksync2-java` SDK, but covers many of the most common operations that developers -require and provides a starting point for those newer to ZKsync Era. - -## Getting zksync-ethers - -### Dependency - -For connecting ZkSync2 library just add the following dependency to your build file. - -Maven `pom.xml` - -```xml - - ... - - - io.zksync - zksync2 - v0.2.0 - - - -``` - -Gradle `build.gradle` - -```groovy -dependencies { - implementation "io.zksync:zksync2:v0.2.0" -} -``` - -## Overview - -While most of the existing SDKs should work out of the box, deploying smart contracts or using unique ZKsync features, -like account abstraction, requires providing additional fields to those that Ethereum transactions have by default. - -To begin, it is useful to have a basic understanding of the types of objects available and what they -are responsible for, at a high level: - -- `ZkSync` provides connection to the ZKsync Era blockchain, which allows querying the blockchain state, - such as account, block or transaction details, querying event logs or evaluating read-only code using call. - Additionally, the client facilitates writing to the blockchain by sending transactions. -- `Wallet` wraps all operations that interact with an account. An account generally has a private key, - which can be used to sign a variety of types of payloads. It provides easy usage of the most common features. - -## Examples - -Connect to the ZKsync Era network: - -```java -import io.zksync.protocol.ZkSync; -import org.web3j.protocol.http.HttpService; - -public class Main { - public static void main(String ...args) { - ZkSync zksync = ZkSync.build(new HttpService("http://127.0.0.1:3050")); - } -} -``` - -Get the latest block number: - -```java -BigInteger blockNumber = zksync.ethBlockNumber().send().getBlockNumber(); -; -``` - -```java -ZksBlock block = zksync.zksGetBlockByHash("0xb472c070c9e121ba42702f6c322b7b266e287a4d8b5fa426ed265b105430c397", true).send().getBlock(); -``` - -```java -ZkTransaction transaction = zksync.zksGetTransactionByHash("0x9af27afed9a4dd018c0625ea1368afb8ba08e4cfb69b3e76dfb8521c8a87ecfc").send().getResult(); -``` diff --git a/content/sdk/40.java/00.introduction/00.overview.md b/content/sdk/40.java/00.introduction/00.overview.md new file mode 100644 index 00000000..6aae4fca --- /dev/null +++ b/content/sdk/40.java/00.introduction/00.overview.md @@ -0,0 +1,45 @@ +--- +title: Overview +description: An introduction to zksync2-java and its features. +tags: ["zksync", "java", "sdk", "blockchain", "ethereum"] +--- + +The `zksync2-java` is a powerful tool designed for developers working with the Ethereum blockchain. + +## What is `zksync2-java`? + +The `zksync2-java` library is a Java SDK designed to facilitate interactions with the ZkSync Era network. It provides a +set of tools and methods that allow developers to: + +- Connect to the ZkSync network using a Web3 provider. +- Estimate transaction fees and gas usage. +- Interact with smart contracts deployed on ZkSync. +- Retrieve detailed information about transactions, blocks, and accounts. +- Utilize ZkSync-specific functionalities such as L1 to L2 transactions, bridge contracts, and more. + +## Key features + +### Seamless integration with web3j + +The `zksync2-java` library builds upon the `web3j` library, ensuring that developers familiar with Web3j can easily +transition to using ZkSync-specific features. It supports all the standard Web3j functionalities while adding +additional methods tailored to the ZkSync Era. + +### ZkSync-specific methods + +The library includes a variety of methods specific to ZkSync, such as: + +- Estimating fees for transactions (`estimateFee`). +- Calculating gas usage for transactions (`estimateGas`, `estimateGasL1`). +- Retrieving account balances and block details. +- Managing transactions between Layer 1 (L1) and Layer 2 (L2). +- Accessing bridge contracts and batch details. + +### Ease of use + +The `zksync2-java` library is designed with simplicity in mind, offering straightforward APIs and +documentation to help developers get started quickly and efficiently. + +::callout{icon="i-heroicons-light-bulb"} +To get started with Java, follow the [installation instructions](/sdk/java/introduction/installation) provided. +:: diff --git a/content/sdk/40.java/00.introduction/01.why-java-sdk.md b/content/sdk/40.java/00.introduction/01.why-java-sdk.md new file mode 100644 index 00000000..31d89f70 --- /dev/null +++ b/content/sdk/40.java/00.introduction/01.why-java-sdk.md @@ -0,0 +1,32 @@ +--- +title: Why zksync2-java +description: Benefits and Advantages of zksync2-java +tags: ["zksync", "java", "ethereum", "layer-2", "zero-knowledge rollups"] +--- + +Choosing the Java SDK for ZKSync opens up a plethora of opportunities for businesses and developers eager to explore +the next generation of blockchain applications. + +Here are key reasons why `zksync2-java` is a valuable addition to your development toolkit: + +### Seamless web3 integration + +- **Built on web3j**: The library extends `web3j`, making it easy for developers familiar with Web3j to start using +ZkSync-specific features without a steep learning curve. +- **Standard and extended functionality**: It supports all standard Web3j functionalities while adding methods unique +to ZkSync Era, enabling more versatile blockchain interactions. + +### ZkSync-specific enhancements + +- **Layer 2 transactions**: Leverage the power of zk-rollups for low-cost, high-throughput transactions. +- **Advanced fee and gas estimation**: Precisely estimate transaction fees and gas usage with methods +like `estimateFee`, `estimateGas`, and `estimateGasL1`. +- **Comprehensive account and block management**: Retrieve detailed information about accounts, blocks, and +transactions on the ZkSync network. +- **Bridge contract access**: Easily interact with ZkSync Era bridge contracts for L1 to L2 operations. + +### User-friendly design + +- **Easy initialization**: Quickly set up your provider with minimal configuration. +- **Clear and concise API**: The library's API is designed for simplicity and ease of use, ensuring you can integrate +it into your projects with minimal effort. diff --git a/content/sdk/40.java/00.introduction/02.installation.md b/content/sdk/40.java/00.introduction/02.installation.md new file mode 100644 index 00000000..7c2c0568 --- /dev/null +++ b/content/sdk/40.java/00.introduction/02.installation.md @@ -0,0 +1,46 @@ +--- +title: Installation +description: How to install and set up zksync2-java for your project. +tags: ["zksync", "java", "sdk installation"] +--- + +Integrating the `zksync2-java` into your Java project equips you with the tools necessary to interact with the +ZKSync Layer-2 blockchain solution efficiently. + +## Prerequisites + +Before beginning the installation, make sure you have: + +- **Java Development Kit (JDK)**: Java 8 or higher installed on your machine. +- **Maven or Gradle**: Depending on your project's build system, ensure Maven or Gradle is set up correctly. + +::callout{icon="i-heroicons-light-bulb"} +Check out the [Java installation guide](https://www.java.com/en/download) for more information. +:: + +## Installation steps + +### Maven setup +For projects using Maven, add the following dependency block to your `pom.xml` file to include the `zksync2-java` SDK: + +```xml + + ... + + + io.zksync + zksync2 + v0.2.0 + + + +``` + +### Gradle setup +For projects utilizing Gradle, add the dependency to your `build.gradle` file as follows: + +```groovy +dependencies { + implementation "io.zksync:zksync2:v0.2.0" +} +``` diff --git a/content/sdk/40.java/01.guides/00.getting-started.md b/content/sdk/40.java/01.guides/00.getting-started.md new file mode 100644 index 00000000..635828a0 --- /dev/null +++ b/content/sdk/40.java/01.guides/00.getting-started.md @@ -0,0 +1,55 @@ +--- +title: Getting Started +description: Getting started with zksync2-java +tag: ["zksync", "java", "blockchain development", "layer-2", "zero-knowledge rollups"] +--- + +This guide is designed to help you quickly get up and running with the SDK, enabling you to interact with the ZKSync +Era blockchain efficiently. + +## Understanding key components + +Before delving into code examples, it's useful to familiarize yourself with the primary objects provided by the SDK and +their responsibilities: + +- **`ZkSync`**: This class provides the connection to the ZKSync Era blockchain. It allows you to query blockchain +states, such as account details, block or transaction information, and event logs. It also facilitates read-only +interactions with the blockchain through calls and enables writing to the blockchain by sending transactions. +- **`Wallet`**: This object encapsulates all operations that interact with a user account. It manages the account's +private key, which is used to sign various types of payloads, and offers straightforward methods for executing common +blockchain functions. + +::callout{icon="i-heroicons-light-bulb"} +Ensure you have installed the `zksync2-java` SDK. If you still need to do so, please refer to +the [installation guide](/sdk/java/introduction/installation) for detailed instructions. +:: + +## Examples + +Connect to the ZKsync Era network: + +```java +import io.zksync.protocol.ZkSync; +import org.web3j.protocol.http.HttpService; + +public class Main { + public static void main(String ...args) { + ZkSync zksync = ZkSync.build(new HttpService("http://127.0.0.1:3050")); + } +} +``` + +Get the latest block number: + +```java +BigInteger blockNumber = zksync.ethBlockNumber().send().getBlockNumber(); +; +``` + +```java +ZksBlock block = zksync.zksGetBlockByHash("0xb472c070c9e121ba42702f6c322b7b266e287a4d8b5fa426ed265b105430c397", true).send().getBlock(); +``` + +```java +ZkTransaction transaction = zksync.zksGetTransactionByHash("0x9af27afed9a4dd018c0625ea1368afb8ba08e4cfb69b3e76dfb8521c8a87ecfc").send().getResult(); +``` diff --git a/content/sdk/40.java/01.features.md b/content/sdk/40.java/01.guides/01.features.md similarity index 73% rename from content/sdk/40.java/01.features.md rename to content/sdk/40.java/01.guides/01.features.md index c59f5a4f..086a574b 100644 --- a/content/sdk/40.java/01.features.md +++ b/content/sdk/40.java/01.guides/01.features.md @@ -1,6 +1,7 @@ --- title: ZKsync Era Features -description: +description: An overview of ZKsync Era features +tags: ["zksync", "java", "ethereum", "blockchain", "eip-712", "paymaster", "sdk"] --- While ZKsync is mostly Web3-compatible, it has some differences compared to Ethereum. The major of those are: @@ -11,10 +12,11 @@ While ZKsync is mostly Web3-compatible, it has some differences compared to Ethe These require us to extend standard Ethereum transactions with new custom fields. Such extended transactions are called EIP712 transactions since [EIP712](https://eips.ethereum.org/EIPS/eip-712) -is used to sign them. You can look at the internal structure of the EIP712 transactions -[here](https://docs.zksync.io/zk-stack/concepts/transaction-lifecycle#eip-712-0x71). +is used to sign them. You can look at the internal structure of the [EIP712 transactions](https://docs.zksync.io/zk-stack/concepts/transaction-lifecycle#eip-712-0x71). +::callout{icon="i-heroicons-light-bulb"} This document will focus solely on how to pass these arguments to the SDK. +:: ## Encoding paymaster params @@ -24,4 +26,4 @@ the Matter Labs team endorses certain types of that are processable by EOAs. ZKsync SDK provides a utility method that can be used to get the correctly formed `paymasterParams` object: -[approvalBased](/sdk/java/paymaster-utils#encodeapprovalbased), [general](/sdk/java/paymaster-utils#encodegeneral). +[approvalBased](/sdk/java/api/utilities/paymaster-utils#encodeapprovalbased), [general](/sdk/java/api/utilities/paymaster-utils#encodegeneral). diff --git a/content/sdk/40.java/04.accounts-l1-l2.md b/content/sdk/40.java/01.guides/02.accounts-l1-l2.md similarity index 74% rename from content/sdk/40.java/04.accounts-l1-l2.md rename to content/sdk/40.java/01.guides/02.accounts-l1-l2.md index 619551e8..1bdc7f6c 100644 --- a/content/sdk/40.java/04.accounts-l1-l2.md +++ b/content/sdk/40.java/01.guides/02.accounts-l1-l2.md @@ -1,9 +1,10 @@ --- -title: Accounts | L1<->L2 Transactions -description: +title: L1<->L2 Transactions +description: Methods for handling transactions between L1 and L2 networks on ZKsync +tags: ["zksync", "l1", "l2", "transactions", "java", "sdk"] --- -This section explores the methods which allow the [account](/sdk/java/accounts) to send transactions +This section explores the methods which allow the [account](/sdk/java/api/accounts/wallet) to send transactions among both L1 to L2 networks. If you want some background on how L1<->L2 interaction works on ZKsync, go through the @@ -12,7 +13,7 @@ If you want some background on how L1<->L2 interaction works on ZKsync, go throu ## Deposit `Wallet` and `L1Signer` objects provide a deposit workflow. -For more information, please refer to the method specification [`Deposit`](/sdk/java/accounts#deposit). +For more information, please refer to the method specification [`Deposit`](/sdk/java/api/accounts/wallet#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: [Deposit ETH and ERC20 token](https://github.com/zksync-sdk/zksync2-examples/blob/main/js/src/01_deposit.ts). @@ -20,17 +21,17 @@ For a complete example of how to execute the deposit workflow, take a look at th ## Request execute `Wallet` and `L1Signer` objects provide an option to request execution of L2 transaction from L1. -For more information, please refer to the method specification [`requestExecute`](/sdk/java/accounts#requestexecute). +For more information, please refer to the method specification [`requestExecute`](/sdk/java/api/accounts/wallet#requestexecute). ## Base cost `Wallet` and `L1Signer` objects provide an option to calculate base cost for L2 transaction. -For more information, please refer to the method specification [`getBaseCost`](/sdk/java/accounts#getbasecost). +For more information, please refer to the method specification [`getBaseCost`](/sdk/java/api/accounts/wallet#getbasecost). ## Withdrawal `Wallet` and `Signer` objects provide a withdrawal workflow. -For more information, please refer to the method specification [`Deposit`](/sdk/java/accounts#deposit). +For more information, please refer to the method specification [`Deposit`](/sdk/java/api/accounts/wallet#deposit). For a complete example of how to execute the deposit workflow, take a look at the following: [Withdraw ETH and ERC20 token](https://github.com/zksync-sdk/zksync2-examples/blob/main/js/src/04_withdraw.ts). diff --git a/content/sdk/40.java/02.api/00.providers/00.introduction.md b/content/sdk/40.java/02.api/00.providers/00.introduction.md new file mode 100644 index 00000000..0897b5ff --- /dev/null +++ b/content/sdk/40.java/02.api/00.providers/00.introduction.md @@ -0,0 +1,20 @@ +--- +title: Introduction +description: Overview of Web3Providers and their functions. +tags: ["web3", "blockchain", "provider", "zksync"] +--- + +A Web3 Provider object provides application-layer access to underlying blockchain networks. It serves as a crucial +interface for interacting with various blockchain functionalities, enabling developers to connect, communicate, and +perform operations on the blockchain. + +The [`zksync2-java`](https://github.com/zksync-sdk/zksync2-java) library supports provider methods from +the [`web3j`](https://docs.web3j.io/4.9.7/) library and supplies additional functionality tailored for the ZKsync Era network. + +### Key features + +- **Network connectivity:** Establishes connections to blockchain networks, allowing applications to interact with them. +- **Transaction management:** Facilitates the creation, sending, and tracking of transactions. +- **Gas estimation:** Provides estimations for the amount of gas required for transactions. +- **Account management:** Retrieves balances and transaction histories for accounts. +- **Contract interaction:** Enables interaction with smart contracts, including deploying and calling contract methods. diff --git a/content/sdk/40.java/02.providers.md b/content/sdk/40.java/02.api/00.providers/01.provider.md similarity index 99% rename from content/sdk/40.java/02.providers.md rename to content/sdk/40.java/02.api/00.providers/01.provider.md index 2906056c..bea24502 100644 --- a/content/sdk/40.java/02.providers.md +++ b/content/sdk/40.java/02.api/00.providers/01.provider.md @@ -1,6 +1,7 @@ --- -title: Providers -description: +title: Provider +description: Web3Provider for zksync2-java +tags: ["web3", "blockchain", "provider", "zksync"] --- A Web3 Provider object provides application-layer access to underlying blockchain networks. diff --git a/content/sdk/40.java/02.api/01.accounts/00.introduction.md b/content/sdk/40.java/02.api/01.accounts/00.introduction.md new file mode 100644 index 00000000..401820e6 --- /dev/null +++ b/content/sdk/40.java/02.api/01.accounts/00.introduction.md @@ -0,0 +1,32 @@ +--- +title: Introduction +description: Manage accounts and sign transactions in the ZKsync2-java. +tags: ["zksync", "account management", "wallet creation", "transaction signing", "cryptocurrency", "ethereum"] +--- + +The `ZKsync2-java` library provides comprehensive classes for managing accounts and signing transactions on the ZKsync network: + +- **`Wallet`**: Manage and sign transactions with ZKsync features. +- **`EthSigner`**: Sign transactions with an Ethereum signer. + +### Why use these classes? + +They simplify ZKsync blockchain interactions by providing: + +- **Security**: Securely manage private keys and sign transactions. +- **Convenience**: Easily create and manage accounts with advanced features. +- **Compatibility**: Extend existing libraries for seamless project integration. + +### Classes + +#### `Wallet` + +The `Wallet` class allows you to create and manage wallets, sign transactions, and interact with the ZKsync network seamlessly. + +#### `EthSigner` + +The `EthSigner` class signs ZKsync transactions using an Ethereum signer, enabling compatibility with Ethereum-based +tools and workflows. + +These classes enhance the functionality and security of managing accounts and signing transactions on the ZKsync +network using the `ZKsync2-java` library. diff --git a/content/sdk/40.java/03.accounts.md b/content/sdk/40.java/02.api/01.accounts/01.wallet.md similarity index 96% rename from content/sdk/40.java/03.accounts.md rename to content/sdk/40.java/02.api/01.accounts/01.wallet.md index 299aab6c..b6f5fee3 100644 --- a/content/sdk/40.java/03.accounts.md +++ b/content/sdk/40.java/02.api/01.accounts/01.wallet.md @@ -1,6 +1,7 @@ --- -title: Accounts -description: +title: Wallet +description: Account functionalities in zksync2-java +tags: ["web3", "blockchain", "zksync", "accounts"] --- ## Overview @@ -552,29 +553,3 @@ Estimates the amount of gas required for a request execute transaction. RequestExecuteTransaction transaction = new RequestExecuteTransaction(null, zksync.zksMainContract().send().getResult(), Numeric.hexStringToByteArray("0x"), BigInteger.valueOf(7000000), null, null, null, null, null); BigInteger baseGasLimit = estimateGasRequestExecute(transaction.toRequestExecute(mainContractAddress)).sendAsync().join().getAmountUsed(); ``` - -## `ETHSigner` - -Provides support for an EIP712 transaction. The methods of this class are mostly used internally. - -### `getDomain` - -Returns the EIP712 domain. - -### `signTypedData` - -Signs typed struct using ethereum private key by EIP-712 signature standard. - -| Parameter | Type | Description | -| ----------- | -------------- | ----------------- | -| `domain` | `Eip712Domain` | EIP712 domain. | -| `typedData` | `S` | EIP712 structure. | - -### `signMessage` - -Signs typed struct using ethereum private key by EIP-712 signature standard. - -| Parameter | Type | Description | -| ----------- | --------- | ------------------------------- | -| `message` | `byte[]` | Message to sign. | -| `addPrefix` | `boolean` | If true then add secure prefix. | diff --git a/content/sdk/40.java/02.api/01.accounts/02.ethsigner.md b/content/sdk/40.java/02.api/01.accounts/02.ethsigner.md new file mode 100644 index 00000000..c1e7d9d1 --- /dev/null +++ b/content/sdk/40.java/02.api/01.accounts/02.ethsigner.md @@ -0,0 +1,29 @@ +--- +title: EthSigner +description: Overview of account functionalities in the zksync2-java +tags: ["web3", "ethsigner", "zksync", "accounts"] +--- + +Provides support for an EIP712 transaction. The methods of this class are mostly used internally. + +### `getDomain` + +Returns the EIP712 domain. + +### `signTypedData` + +Signs typed struct using ethereum private key by EIP-712 signature standard. + +| Parameter | Type | Description | +| ----------- | -------------- | ----------------- | +| `domain` | `Eip712Domain` | EIP712 domain. | +| `typedData` | `S` | EIP712 structure. | + +### `signMessage` + +Signs typed struct using ethereum private key by EIP-712 signature standard. + +| Parameter | Type | Description | +| ----------- | --------- | ------------------------------- | +| `message` | `byte[]` | Message to sign. | +| `addPrefix` | `boolean` | If true then add secure prefix. | diff --git a/content/sdk/40.java/05.contracts.md b/content/sdk/40.java/02.api/02.contract/00.contracts.md similarity index 67% rename from content/sdk/40.java/05.contracts.md rename to content/sdk/40.java/02.api/02.contract/00.contracts.md index dfcc48a2..7ef0ec10 100644 --- a/content/sdk/40.java/05.contracts.md +++ b/content/sdk/40.java/02.api/02.contract/00.contracts.md @@ -1,8 +1,10 @@ --- -title: Contracts -description: +title: Contract Interfaces +description: System contracts for interacting with the ZKsync Era network +tags: ["web3", "blockchain", "zksync", "contracts"] --- + `zksync2-java` implements contract wrappers. Created using [web3j CLI](https://docs.web3j.io/4.8.7/command_line_tools/#solidity-smart-contract-wrapper-generator) diff --git a/content/sdk/40.java/06.utils.md b/content/sdk/40.java/02.api/03.utilities/00.utils.md similarity index 98% rename from content/sdk/40.java/06.utils.md rename to content/sdk/40.java/02.api/03.utilities/00.utils.md index 261dcc72..8c99da32 100644 --- a/content/sdk/40.java/06.utils.md +++ b/content/sdk/40.java/02.api/03.utilities/00.utils.md @@ -1,6 +1,7 @@ --- title: Utilities -description: +description: Essential utilities for building on the ZKsync Era +tags: ["web3", "blockchain", "zksync", "utilities"] --- The [utilities package](https://github.com/zksync-sdk/zksync2-java/tree/master/src/main/java/io/zksync/utils) diff --git a/content/sdk/40.java/07.paymaster-utils.md b/content/sdk/40.java/02.api/03.utilities/01.paymaster-utils.md similarity index 92% rename from content/sdk/40.java/07.paymaster-utils.md rename to content/sdk/40.java/02.api/03.utilities/01.paymaster-utils.md index 4501ad02..303703be 100644 --- a/content/sdk/40.java/07.paymaster-utils.md +++ b/content/sdk/40.java/02.api/03.utilities/01.paymaster-utils.md @@ -1,6 +1,7 @@ --- title: Paymaster Utilities -description: +description: Essential utilities for using paymasters on ZKsync Era +tags: ["web3", "blockchain", "zksync", "paymasters", "utilities"] --- The [paymaster utilities](https://github.com/zksync-sdk/zksync2-java/blob/master/src/main/java/io/zksync/utils/Paymaster.java) diff --git a/content/sdk/40.java/02.api/_dir.yml b/content/sdk/40.java/02.api/_dir.yml new file mode 100644 index 00000000..04d91e0c --- /dev/null +++ b/content/sdk/40.java/02.api/_dir.yml @@ -0,0 +1 @@ +title: API diff --git a/content/sdk/40.java/08.types.md b/content/sdk/40.java/04.types.md similarity index 97% rename from content/sdk/40.java/08.types.md rename to content/sdk/40.java/04.types.md index 40ddc40b..7a42c833 100644 --- a/content/sdk/40.java/08.types.md +++ b/content/sdk/40.java/04.types.md @@ -1,6 +1,7 @@ --- -title: Types and Interfaces -description: +title: Types +description: Detailed reference for all types used in the zksync2-java +tags: ["web3", "blockchain", "zksync", "types", "sdk"] --- ## `AccountAbstractionVersion`