Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: additional zksync utility functions #2448

Open
wants to merge 100 commits into
base: main
Choose a base branch
from

Conversation

nikola-bozin-txfusion
Copy link
Contributor

@nikola-bozin-txfusion nikola-bozin-txfusion commented Jun 28, 2024

Overview

This PR introduces additional functionality for the ZkSync L2 Network.

Detailed summary

Added transfer, claimFailedDeposit and new zks namespace publicL2 actions which enable enhanced interaction with zkSync L2 Network.


PR-Codex overview

This PR introduces new enums and types related to priority queue and transactions, updates chain definitions, adds fee configurations, and implements utility functions for deposit and gas limit scaling.

Detailed summary

  • Added PriorityQueueType and PriorityOpTree enums
  • Updated chain definitions with new RPC URLs
  • Implemented utility functions for deposit and gas limit scaling
  • Added new transaction types for transfers and withdrawals
  • Configured fee values for mainnet chain
  • Implemented functions for address generation and comparison
  • Updated test cases for various actions and utilities

The following files were skipped due to too many changes: src/chains/index.ts, src/zksync/actions/getFeeParameters.test.ts, src/zksync/actions/estimateGasL1ToL2.ts, src/zksync/utils/claim-failed-deposit/undoL1ToL2Alias.ts, site/pages/zksync/actions/getProtocolVersion.md, site/pages/zksync/actions/getFeeParameters.md, src/zksync/utils/withdraw/isWithdrawalFinalized.test.ts, src/zksync/constants/address.ts, src/zksync/utils/deposit/estimateL1ToL2Execute.test.ts, src/zksync/utils/applyL1ToL2Alias.test.ts, site/pages/zksync/actions/getConfirmedTokens.md, src/utils/address/createRandomAddress.test.ts, src/zksync/utils/deposit/getL2HashFromPriorityOp.test.ts, src/zksync/actions/l1Bridge.test.ts, src/zksync/utils/deposit/layer1TxDefaults.test.ts, src/zksync/utils/deposit/estimateDefaultBridgeDepositL2Gas.test.ts, src/zksync/utils/deposit/getL2GasLimit.test.ts, src/zksync/utils/deposit/getErc20BridgeCalldata.ts, src/zksync/actions/getConfirmedTokens.test.ts, src/zksync/actions/l1Bridge.ts, src/zksync/utils/deposit/estimateCustomBridgeDepositL2Gas.test.ts, src/zksync/actions/l2TokenAddress.test.ts, src/zksync/utils/withdraw/initiateWithdrawal.test.ts, src/zksync/utils/withdraw/isL2BridgeLegacy.ts, src/zksync/actions/sharedBridge.ts, src/zksync/utils/deposit/getErc20BridgeCalldata.test.ts, src/zksync/utils/withdraw/l1SharedBridge.ts, src/zksync/utils/isEthBasedChain.ts, src/zksync/utils/deposit/getBaseCost.ts, src/zksync/actions/getBaseToken.ts, src/zksync/actions/getL2BridgeAddress.ts, src/zksync/utils/deposit/constructRequestL2TransactionTwoBridges.test.ts, src/zksync/utils/deposit/scaleGasLimit.test.ts, site/pages/zksync/actions/sharedBridge.md, site/pages/zksync/actions/getL2BridgeAddress.md, src/zksync/actions/getConfirmedTokens.ts, src/zksync/utils/deposit/getDepositETHOnETHBasedChainTx.ts, src/zksync/actions/getErc20ContractValue.ts, src/zksync/actions/getFeeParameters.ts, src/zksync/actions/l2TokenAddress.ts, site/pages/zksync/actions/getBaseToken.md, src/zksync/actions/getLogProof.ts, src/zksync/utils/withdraw/getWithdrawTxArgs.test.ts, src/zksync/utils/deposit/isBaseToken.ts, src/zksync/utils/deposit/checkBaseCost.test.ts, site/pages/zksync/actions/sendRawTransactionWithDetailedOutput.md, src/zksync/actions/sendRawTransactionWithDetailedOutput.test.ts, src/zksync/utils/l2TokenAddress.test.ts, src/zksync/actions/sharedBridge.test.ts, src/zksync/utils/withdraw/isWithdrawalFinalized.ts, src/zksync/types/deposit.ts, src/zksync/utils/deposit/getBaseCost.test.ts, src/zksync/actions/getBaseToken.test.ts, site/pages/zksync/actions/approveErc20L1.md, src/zksync/utils/withdraw/createWithdrawSpecification.test.ts, src/zksync/types/eip1193.ts, src/zksync/actions/getL2TransactionBaseCost.ts, src/zksync/actions/isWithdrawalFinalized.ts, src/zksync/utils/deposit/getDepositBaseTokenOnNonEthBasedChainTx.ts, site/pages/zksync/actions/l2TransactionBaseCost.md, src/zksync/utils/withdraw/waitFinalize.ts, src/zksync/actions/getProtocolVersion.ts, src/zksync/utils/l2TokenAddress.ts, src/zksync/utils/deposit/getL2HashFromPriorityOp.ts, src/zksync/utils/claim-failed-deposit/undoL1ToL2Alias.test.ts, src/zksync/utils/deposit/getPriorityOpConfirmation.ts, src/zksync/utils/withdraw/getErc20TokenBalance.ts, site/pages/zksync/actions/getErc20ContractValue.md, src/zksync/utils/deposit/getDepositTokenOnEthBasedChainTx.ts, src/zksync/utils/withdraw/initiateWithdrawal.ts, src/zksync/utils/deposit/getDepositNonBaseTokenToNonETHBasedChainTx.ts, src/zksync/utils/deposit/getPriorityOpConfirmationL2ToL1Log.ts, src/zksync/utils/withdraw/getWithdrawalL2ToL1Log.ts, src/zksync/actions/getL2BridgeAddress.test.ts, src/zksync/utils/deposit/getTransactionStatusL2.ts, src/zksync/utils/deposit/constructDepositSpecification.ts, src/zksync/utils/deposit/getDepositETHOnNonETHBasedChainTx.ts, src/zksync/actions/getProtocolVersion.test.ts, site/pages/zksync/utilities/withdraw/finalizeWithdrawal.md, src/zksync/utils/deposit/getL2GasLimit.ts, src/zksync/actions/sendRawTransactionWithDetailedOutput.ts, src/zksync/utils/deposit/estimateCustomBridgeDepositL2Gas.ts, src/zksync/actions/requestL2TransactionDirect.ts, src/zksync/utils/deposit/getRequestExecuteTxDefaults.ts, src/utils/address/isAddressEqualLite.test.ts, src/zksync/actions/getAllowanceL1.ts, site/pages/zksync/utilities/deposit/getL2TransactionFromPriorityOp.md, src/zksync/actions/approveL1Erc20Token.test.ts, src/zksync/actions/requestL2TransactionTwoBridges.ts, src/zksync/utils/deposit/estimateL1ToL2Execute.ts, src/zksync/utils/deposit/getERC20DefaultBridgeData.test.ts, src/zksync/utils/deposit/getL2TransactionFromPriorityOp.ts, src/zksync/utils/deposit/getRequestExecuteTxDefaults.test.ts, src/zksync/actions/getL2TransactionBaseCost.test.ts, src/zksync/utils/deposit/buildDepositEthToEthBasedChainTransaction.test.ts, src/zksync/utils/withdraw/getWithdrawalLog.ts, site/pages/zksync/actions/requestL2TransactionDirect.md, src/zksync/utils/deposit/buildDepositTokenToEthBasedChainTransaction.test.ts, src/zksync/utils/deposit/getL2GasLimitFromCustomBridge.ts, site/pages/zksync/actions/requestL2TransactionTwoBridges.md, src/zksync/utils/withdraw/createWithdrawSpecification.ts, src/zksync/utils/withdraw/getL2WithdrawalData.ts, src/zksync/actions/getBalanceOfTokenL1.ts, src/zksync/actions/getRawBlockTransaction.ts, src/zksync/actions/approveL1Erc20Token.ts, src/zksync/utils/deposit/constructRequestL2TransactionDirectParameters.test.ts, src/zksync/utils/deposit/constructDepositSpecification.test.ts, src/zksync/index.ts, site/pages/zksync/actions/getBalanceOfTokenL1.md, src/zksync/actions/getBalanceL1.ts, src/zksync/utils/deposit/getERC20DefaultBridgeData.ts, src/zksync/utils/deposit/getDepositTxWithDefaults.ts, src/zksync/utils/deposit/constructRequestL2TransactionTwoBridges.ts, src/zksync/utils/deposit/buildDepositEthToEthBasedChainTransaction.ts, src/zksync/actions/requestL2TransactionDirect.test.ts, src/zksync/actions/requestL2TransactionTwoBridges.test.ts, src/zksync/utils/deposit/estimateDefaultBridgeDepositL2Gas.ts, site/pages/zksync/actions/getBalanceL1.md, src/zksync/utils/deposit/getDepositTxWithDefaults.test.ts, src/zksync/utils/deposit/buildDepositBaseTokenToNonEthBasedChainTransaction.test.ts, src/zksync/utils/deposit/getDepositETHOnETHBasedChainTx.test.ts, src/zksync/actions/getErc20ContractValue.test.ts, src/zksync/utils/deposit/getDepositBaseTokenOnNonEthBasedChainTx.test.ts, src/zksync/utils/claim-failed-deposit/claimFailedDeposit.test.ts, src/zksync/utils/transfer/transfer.ts, src/zksync/utils/deposit/getDepositETHOnNonETHBasedChainTx.test.ts, src/zksync/utils/deposit/getDepositTokenOnEthBasedChainTx.test.ts, src/zksync/utils/deposit/buildDepositTransaction.ts, src/zksync/utils/deposit/getDepositNonBaseTokenToNonETHBasedChainTx.test.ts, site/pages/zksync/actions/getAllowanceL1.md, site/sidebar.ts, src/zksync/utils/deposit/buildDepositEthToNonEthBasedChainTransaction.test.ts, site/pages/zksync/utilities/withdraw/initiateWithdrawal.md, src/zksync/utils/withdraw/finalizeWithdrawal.ts, src/zksync/types/zksRpcScheme.ts, src/zksync/utils/deposit/buildDepositTransaction.test.ts, src/zksync/utils/claim-failed-deposit/claimFailedDeposit.ts, src/zksync/utils/deposit/buildDepositNonBaseTokenToNonEthBasedChainTransaction.test.ts, src/zksync/actions/getAllowanceL1.test.ts, src/zksync/utils/deposit/buildDepositBaseTokenToNonEthBasedChainTransaction.ts, src/zksync/utils/deposit/buildDepositTokenToEthBasedChainTransaction.ts, src/zksync/utils/deposit/buildDepositEthToNonEthBasedChainTransaction.ts, src/zksync/utils/deposit/constructRequestL2TransactionDirectParameters.ts, src/zksync/utils/withdraw/getWithdrawTxArgs.ts, src/zksync/actions/getBalanceL1.test.ts, src/zksync/actions/getBalanceOfTokenL1.test.ts, src/zksync/utils/deposit/buildDepositNonBaseTokenToNonEthBasedChainTransaction.ts, src/zksync/decorators/publicL1.test.ts, src/zksync/decorators/publicL2.ts, src/zksync/utils/transfer/transfer.test.ts, site/pages/zksync/utilities/deposit/buildDepositTransaction.md, src/zksync/utils/deposit/deposit-integration.test.ts, site/pages/zksync/guides/withdraw.md, src/zksync/decorators/publicL1.ts, src/zksync/utils/withdraw/withdraw.test.ts, site/pages/zksync/guides/deposits.md, test/src/zksyncPublicActionsL2MockData.ts, test/src/zksync.ts, src/zksync/constants/abis.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented Jun 28, 2024

⚠️ No Changeset found

Latest commit: fcb2715

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jun 28, 2024

@nikola-bozin-txfusion is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@jxom
Copy link
Member

jxom commented Jun 30, 2024

Can we please rebase this PR against main to clean the diff?

@nikola-bozin-txfusion
Copy link
Contributor Author

Can we please rebase this PR against main to clean the diff?

Could you please confirm the rebase success against the main branch?

@jxom
Copy link
Member

jxom commented Jun 30, 2024

The diff should only consist of the changes related to this PR.

@jxom jxom force-pushed the main branch 2 times, most recently from d51b614 to 0ddb001 Compare July 21, 2024 09:52
@jxom jxom force-pushed the main branch 3 times, most recently from b56e162 to ad2831b Compare September 7, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants