Skip to content

Commit

Permalink
chore: update utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Ngozi-Txfusion committed Jul 3, 2024
1 parent a5528e3 commit f9fa7b0
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async estimateFee(transaction: TransactionRequest): Promise<Fee>
```

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const fee = await provider.estimateFee({
Expand Down Expand Up @@ -129,7 +129,7 @@ async estimateGasL1(transaction: TransactionRequest): Promise<BigNumber>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const gasL1 = await provider.estimateGasL1({
Expand Down Expand Up @@ -264,7 +264,7 @@ async estimateL1ToL2Execute(transaction: {
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const gasL1ToL2 = await provider.estimateL1ToL2Execute({
Expand Down Expand Up @@ -296,7 +296,7 @@ async getAllAccountBalances(address: Address): Promise<BalancesMap>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const balances = await provider.getAllAccountBalances("0x36615Cf349d7F6344891B1e7CA7C72883F5dc049");
Expand Down Expand Up @@ -324,7 +324,7 @@ async getBalance(address: Address, blockTag?: BlockTag, tokenAddress?: Address)
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const account = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049";
Expand All @@ -346,7 +346,7 @@ async getBaseTokenContractAddress(): Promise<Address>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Base token: ${await provider.getBaseTokenContractAddress()}`);
Expand All @@ -363,7 +363,7 @@ async getBlock(blockHashOrBlockTag: BlockTag | string | Promise<BlockTag | strin
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Block: ${toJSON(await provider.getBlock("latest", true))}`);
Expand All @@ -388,7 +388,7 @@ async getBlockDetails(number:number): Promise<BlockDetails>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Block details: ${toJSON(await provider.getBlockDetails(90_000))}`);
Expand All @@ -407,7 +407,7 @@ async getBridgehubContractAddress(): Promise<Address>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Bridgehub: ${await provider.getBridgehubContractAddress()}`);
Expand All @@ -432,7 +432,7 @@ async getBytecodeByHash(bytecodeHash: BytesLike): Promise<Uint8Array>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

// Bytecode hash can be computed by following these steps:
// const testnetPaymasterBytecode = await provider.getCode(await provider.getTestnetPaymasterAddress());
Expand Down Expand Up @@ -489,7 +489,7 @@ async getContractAccountInfo(address:Address): Promise<ContractAccountInfo>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const tokenAddress = "0x927488F48ffbc32112F1fF721759649A89721F8F"; // Crown token which can be minted for free
Expand All @@ -514,7 +514,7 @@ getDefaultBridgeAddresses(): Promise<{
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Default bridges: ${toJSON(await provider.getDefaultBridgeAddresses())}`);
Expand All @@ -538,7 +538,7 @@ async connectL2Bridge(address: Address): Promise<Il2SharedBridge | Il2Bridge>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const l2Bridge = await provider.connectL2Bridge("<L2_BRIDGE_ADDRESS>");
Expand All @@ -561,7 +561,7 @@ async isL2BridgeLegacy(address: Address): Promise<boolean>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const isBridgeLegacy = await provider.isL2BridgeLegacy("<L2_BRIDGE_ADDRESS>");
Expand All @@ -585,7 +585,7 @@ static getDefaultProvider(zksyncNetwork: ZkSyncNetwork = ZkSyncNetwork.Localhost
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const providerMainnet = Provider.getDefaultProvider(types.Network.Mainnet);
const providerTestnet = Provider.getDefaultProvider(types.Network.Sepolia);
Expand Down Expand Up @@ -652,7 +652,7 @@ static override getFormatter(): Formatter
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const formatter = Provider.getFormatter();
```
Expand All @@ -668,7 +668,7 @@ async getGasPrice(): Promise<BigNumber>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Gas price: ${await provider.getGasPrice()}`);
Expand All @@ -694,7 +694,7 @@ async getL1BatchBlockRange(l1BatchNumber: number): Promise<[number, number] | nu
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const l1BatchNumber = await provider.getL1BatchNumber();
Expand All @@ -720,7 +720,7 @@ async getL1BatchDetails(number: number): Promise<BatchDetails>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const l1BatchNumber = await provider.getL1BatchNumber();
Expand All @@ -740,7 +740,7 @@ async getL1BatchNumber(): Promise<number>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`L1 batch number: ${await provider.getL1BatchNumber()}`);
Expand All @@ -763,7 +763,7 @@ async getL2TransactionFromPriorityOp(l1TxResponse: ethers.TransactionResponse):
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const ethProvider = ethers.getDefaultProvider("sepolia");
Expand Down Expand Up @@ -794,7 +794,7 @@ async getLogProof(txHash: BytesLike, index ? : number): Promise<MessageProof | n
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
// Any L2 -> L1 transaction can be used.
Expand All @@ -821,7 +821,7 @@ getLogs(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Logs: ${toJSON(await provider.getLogs({ fromBlock: 0, toBlock: 5, address: utils.L2_ETH_TOKEN_ADDRESS }))}`);
Expand All @@ -840,7 +840,7 @@ async getMainContractAddress(): Promise<Address>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Main contract: ${await provider.getMainContractAddress()}`);
Expand Down Expand Up @@ -896,7 +896,7 @@ async getPriorityOpResponse(l1TxResponse: ethers.TransactionResponse): Promise<P
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const ethProvider = ethers.getDefaultProvider("sepolia");
Expand Down Expand Up @@ -974,7 +974,7 @@ async getProtocolVersion(id?: number): Promise<ProtocolVersion>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Protocol version: ${await provider.getProtocolVersion()}`);
Expand All @@ -1000,7 +1000,7 @@ async getRawBlockTransactions(number: number): Promise<RawBlockTransaction[]>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Raw block transactions: ${toJSON(await provider.getRawBlockTransactions(90_000))}`);
Expand All @@ -1018,7 +1018,7 @@ async getTestnetPaymasterAddress(): Promise<Address | null>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Testnet paymaster: ${await provider.getTestnetPaymasterAddress()}`);
Expand All @@ -1042,7 +1042,7 @@ async getTransaction(hash: string | Promise<string>): Promise<TransactionRespons
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);

Expand Down Expand Up @@ -1075,7 +1075,7 @@ async getTransactionDetails(txHash: BytesLike): Promise<TransactionDetails>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);

Expand All @@ -1102,7 +1102,7 @@ async getTransactionReceipt(transactionHash: string | Promise<string>): Promise<
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
const TX_HASH = "<YOUR_TX_HASH_ADDRESS>";
Expand All @@ -1126,7 +1126,7 @@ async getTransactionStatus(txHash: string): Promise<TransactionStatus>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);

Expand Down Expand Up @@ -1289,7 +1289,7 @@ async isBaseToken(token: Address): Promise<string>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Is base token: ${await provider.isBaseToken("0x5C221E77624690fff6dd741493D735a17716c26B")}`);
Expand All @@ -1306,7 +1306,7 @@ async isEthBasedChain(): Promise<boolean>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`Is ETH based chain: ${await provider.isEthBasedChain()}`);
Expand All @@ -1325,7 +1325,7 @@ async l1ChainId(): Promise<number>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`L1 chain ID: ${await provider.l1ChainId()}`);
Expand Down Expand Up @@ -1353,7 +1353,7 @@ async l1TokenAddress(token: Address): Promise<string>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`L1 token address: ${await provider.l1TokenAddress("0x3e7676937A7E96CFB7616f255b9AD9FF47363D4b")}`);
Expand Down Expand Up @@ -1382,7 +1382,7 @@ async l2TokenAddress(token: Address): Promise<string>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`L2 token address: ${await provider.l2TokenAddress("0x5C221E77624690fff6dd741493D735a17716c26B")}`);
Expand All @@ -1400,7 +1400,7 @@ async newBlockFilter(): Promise<BigNumber>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`New block filter: ${await provider.newBlockFilter()}`);
Expand Down Expand Up @@ -1450,7 +1450,7 @@ async newPendingTransactionsFilter(): Promise<BigNumber>
#### Example

```ts
import { Provider, types } from "zksync-ethers";
import { Provider, types, utils } from "zksync-ethers";

const provider = Provider.getDefaultProvider(types.Network.Sepolia);
console.log(`New pending transaction filter: ${await provider.newPendingTransactionsFilter()}`);
Expand Down
Loading

0 comments on commit f9fa7b0

Please sign in to comment.