Skip to content

Commit

Permalink
chore: zksync rename (#2586)
Browse files Browse the repository at this point in the history
* fix: rename zkSync to ZKsync

* fix: update changeset

* fix: add deprecation in all places and force file case

* fix: remove redundant files

* fix: fix export lint error

* refactor: deprecation notices

* chore: tweaks

* chore: tweak changeset

---------

Co-authored-by: Jack Hamer <[email protected]>
Co-authored-by: jxom <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2024
1 parent 4998dc3 commit 0b1693a
Show file tree
Hide file tree
Showing 100 changed files with 715 additions and 571 deletions.
11 changes: 11 additions & 0 deletions .changeset/new-mails-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"viem": minor
---

Renamed "zkSync" to "ZKsync":
- Context: "zkSync" was officially renamed to "ZKsync" a while ago.
- Variable names: `zkSync` -> `zksync` (for simplicity and consistency between folder/file names and variables).
- Types: `ZkSync` -> `Zksync`.
- Old naming still remains in Viem, however is marked as `@deprecated` and will be removed in the next major release.

Removed deprecated `zkSyncTestnet` chain.
20 changes: 10 additions & 10 deletions site/pages/docs/chains/zksync.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# zkSync [Integrating with zkSync in Viem]
# ZKsync [Integrating with ZKsync in Viem]

Viem provides first-class support for chains implemented on [zkSync](https://zksync.io/).
Viem provides first-class support for chains implemented on [ZKsync](https://zksync.io/).

## Chains

The following Viem chains are implemented on zkSync:
The following Viem chains are implemented on ZKsync:

```ts
import {
zkSync, // [!code hl]
zkSyncTestnet, // [!code hl]
zksync, // [!code hl]
zksyncSepoliaTestnet, // [!code hl]
} from 'viem/chains'
```

### Configuration

Viem exports zkSync's chain [formatters](/docs/chains/formatters) & [serializers](/docs/chains/serializers) via `chainConfig`. This is useful if you need to define another chain which is implemented on zkSync.
Viem exports ZKsync's chain [formatters](/docs/chains/formatters) & [serializers](/docs/chains/serializers) via `chainConfig`. This is useful if you need to define another chain which is implemented on ZKsync.

```ts
import { defineChain } from 'viem'
import { chainConfig } from 'viem/zkSync'
import { chainConfig } from 'viem/zksync'

export const zkSyncExample = defineChain({
...chainConfig,
name: 'zkSync Example',
name: 'ZKsync Example',
// ...
})
```
Expand All @@ -34,15 +34,15 @@ export const zkSyncExample = defineChain({

Serializes a transaction object. Supports EIP-712, EIP-1559, EIP-2930, and Legacy transactions.

zkSync-flavored version of [Viem's `serializeTransaction`](/docs/utilities/serializeTransaction).
ZKsync-flavored version of [Viem's `serializeTransaction`](/docs/utilities/serializeTransaction).

#### Parameters

- `transaction` (`TransactionSerializable`): The transaction object to serialize.
- `signature` (`Signature`): Optional signature to include.

```ts
import { serializeTransaction } from 'viem/celo'
import { serializeTransaction } from 'viem/zksync'

const serialized = serializeTransaction({
chainId: 1,
Expand Down
24 changes: 12 additions & 12 deletions site/pages/zksync.mdx
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
---
description: Getting tarted with the zkSync in Viem
description: Getting tarted with the ZKsync in Viem
---

# Getting Started with zkSync
# Getting Started with ZKsync

Viem provides first-class support for the [zkSync](https://zksync.io) chain.
Viem provides first-class support for the [ZKsync](https://zksync.io) chain.

zkSync is a Layer-2 protocol that scales Ethereum with cutting-edge ZK tech.
ZKsync is a Layer-2 protocol that scales Ethereum with cutting-edge ZK tech.

## Quick Start

### 1. Set up your Client & Transport

Firstly, set up your [Client](/docs/clients/intro) with a desired [Transport](/docs/clients/intro) & [zkSync Chain](./zksync/chains.md) and extend it with zkSync EIP712 actions.
Firstly, set up your [Client](/docs/clients/intro) with a desired [Transport](/docs/clients/intro) & [ZKsync Chain](./zksync/chains.md) and extend it with ZKsync EIP712 actions.

```ts twoslash
import 'viem/window'
// ---cut---
import { createWalletClient, custom } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { eip712WalletActions } from 'viem/zksync'

const walletClient = createWalletClient({ // [!code hl]
chain: zkSync, // [!code hl]
chain: zksync, // [!code hl]
transport: custom(window.ethereum!), // [!code hl]
}).extend(eip712WalletActions()) // [!code hl]
```

### 2. Use Actions

Now that you have a Client set up, you can [send a transaction](./zksync/actions/sendTransaction.md) on zkSync using a [paymaster](https://docs.zksync.io/build/developer-reference/account-abstraction.html#paymasters)!
Now that you have a Client set up, you can [send a transaction](./zksync/actions/sendTransaction.md) on ZKsync using a [paymaster](https://docs.zksync.io/build/developer-reference/account-abstraction.html#paymasters)!

```ts twoslash
import 'viem/window'
import { createWalletClient, custom } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { eip712WalletActions } from 'viem/zksync'

const walletClient = createWalletClient({
chain: zkSync,
chain: zksync,
transport: custom(window.ethereum!),
}).extend(eip712WalletActions())
// ---cut---
Expand All @@ -56,12 +56,12 @@ const hash = await walletClient.sendTransaction({
```ts twoslash
import 'viem/window'
import { createWalletClient, custom, parseAbi } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { eip712WalletActions } from 'viem/zksync'

const walletClient = createWalletClient({
account: '0x',
chain: zkSync,
chain: zksync,
transport: custom(window.ethereum!),
}).extend(eip712WalletActions())
// ---cut---
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/estimateFee.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const fee = await client.estimateFee({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/estimateGasL1ToL2.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const gas = await client.estimateGasL1ToL2({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getAllBalances.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const balances = await client.getAllBalances({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())

Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getBaseTokenL1Address.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const address = await client.getBaseTokenL1Address();

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
10 changes: 5 additions & 5 deletions site/pages/zksync/actions/getBlockDetails.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
description: Returns additional zkSync-specific information about the L2 block.
description: Returns additional ZKsync-specific information about the L2 block.
---

# getBlockDetails

Returns additional zkSync-specific information about the L2 block.
Returns additional ZKsync-specific information about the L2 block.

## Usage

Expand All @@ -20,11 +20,11 @@ const blockDetails = await client.getBlockDetails({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand All @@ -34,7 +34,7 @@ export const client = createPublicClient({

`BaseBlockDetails`

Structure that represent zkSync-specific information about L2 block.
Structure that represent ZKsync-specific information about L2 block.

## Parameters

Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getBridgehubContractAddress.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const address = await client.getBridgehubContractAddress();

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
10 changes: 5 additions & 5 deletions site/pages/zksync/actions/getDefaultBridgeAddress.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
description: Returns the addresses of the default zkSync Era bridge contracts on both L1 and L2.
description: Returns the addresses of the default ZKsync Era bridge contracts on both L1 and L2.
---

# getDefaultBridgeAddresses

Returns the addresses of the default zkSync Era bridge contracts on both L1 and L2.
Returns the addresses of the default ZKsync Era bridge contracts on both L1 and L2.

## Usage

Expand All @@ -18,11 +18,11 @@ const addresses = await client.getDefaultBridgeAddresses();

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand All @@ -32,4 +32,4 @@ export const client = createPublicClient({

`GetDefaultBridgeAddressesReturnType`

Addresses of the default zkSync Era bridge contracts on both L1 and L2.
Addresses of the default ZKsync Era bridge contracts on both L1 and L2.
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getL1BatchBlockRange.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const batchBlockRange = await client.getL1BatchBlockRange({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getL1BatchDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const batchDetails = await client.getL1BatchDetails({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getL1BatchNumber.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const latestNumber = await client.getL1BatchNumber();
```
```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getL1ChainId.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const chainId = await client.getL1ChainId();

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getLogProof.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const proof = await client.getLogProof({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
10 changes: 5 additions & 5 deletions site/pages/zksync/actions/getMainContractAddress.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
description: Returns the address of a Main zkSync Contract.
description: Returns the address of a Main ZKsync Contract.
---

# getMainContractAddress

Returns the address of a Main zkSync Contract.
Returns the address of a Main ZKsync Contract.

## Usage

Expand All @@ -18,11 +18,11 @@ const address = await client.getMainContractAddress();

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand All @@ -32,4 +32,4 @@ export const client = createPublicClient({

`Address`

Main zkSync Era smart contract address.
Main ZKsync Era smart contract address.
4 changes: 2 additions & 2 deletions site/pages/zksync/actions/getRawBlockTransactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const rawTx = await client.getRawBlockTransaction({

```ts [config.ts]
import { createPublicClient, http } from 'viem'
import { zkSync } from 'viem/chains'
import { zksync } from 'viem/chains'
import { publicActionsL2 } from 'viem/zksync'

export const client = createPublicClient({
chain: zkSync,
chain: zksync,
transport: http(),
}).extend(publicActionsL2())
```
Expand Down
Loading

0 comments on commit 0b1693a

Please sign in to comment.