-
Notifications
You must be signed in to change notification settings - Fork 161
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
Tracing Deposits and Withdrawals #966
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docs-optimism ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WalkthroughThe changes involve updating documentation and code to replace references to the "Optimism SDK" with the "viem" library. This includes revising a tutorial to guide users on utilizing the viem library for tracing transactions between Layer 1 and Layer 2. Additionally, the JavaScript script has been modified to use the viem library for creating public clients and retrieving transaction data. The Changes
Possibly related issues
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (7)
pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (6)
12-14
: LGTM: Introduction updated to reflect the use of viem library.The introduction has been appropriately updated to mention the viem library. However, consider adding a brief explanation of why viem is being used instead of the Optimism SDK to provide context for the change.
Consider adding a sentence explaining the reason for switching to viem, such as:
"We now recommend using viem as it provides improved performance and a more streamlined API for interacting with Ethereum networks."
22-23
: LGTM: Project setup instructions updated for viem.The project setup instructions have been correctly updated to use the viem library. However, there's a minor inconsistency in the installation step.
In the installation step, the comment mentions installing both viem and ethers.js, but the command only installs viem. Consider either removing the mention of ethers.js or adding it to the installation command if it's needed for the tutorial.
Also applies to: 40-43
49-55
: LGTM: RPC URL section updated for viem and new networks.The section has been appropriately updated to mention the viem library's
getTransactionReceipt
function and the new network URLs for Sepolia and OP Sepolia.Consider adding a brief explanation of why Sepolia and OP Sepolia are being used (e.g., "We're using Sepolia and OP Sepolia as they are the current testnet environments for Ethereum and Optimism, respectively.").
105-133
: LGTM: Deposit tracing steps updated for viem.The deposit tracing steps have been appropriately updated to use viem functions instead of the Optimism SDK. The instructions are clear and provide a good guide for users.
Consider adding brief comments explaining what each step does, especially for the log parsing step. This would help users understand the purpose of each operation in the tracing process.
138-165
: LGTM: Withdrawal tracing steps updated for viem.The withdrawal tracing steps have been appropriately updated to use viem functions instead of the Optimism SDK. The instructions are clear and provide a good guide for users.
Similar to the deposit tracing section, consider adding brief comments explaining what each step does, especially for the log parsing step. This would help users understand the purpose of each operation in the withdrawal tracing process.
Line range hint
1-172
: Overall: Excellent update to use viem library.The tutorial has been successfully updated to use the viem library instead of the Optimism SDK. The changes are consistent throughout the file, maintaining the tutorial's structure and flow while providing clear instructions for using viem to trace deposits and withdrawals.
To further improve the tutorial:
- Consider adding a brief introduction explaining why viem is now recommended over the Optimism SDK.
- Add more explanatory comments to the code snippets to help users understand each step of the process.
- Ensure that all linked tutorials and resources are also updated or include notes about any differences in the libraries used.
public/tutorials/sdk-trace-txns.js (1)
9-10
: Add error handling for missing RPC URLs.It's a good practice to check if
l1RpcUrl
andl2RpcUrl
are defined to prevent runtime errors if the environment variables are not set.Consider adding error handling:
const l1RpcUrl = process.env.L1_RPC_URL; const l2RpcUrl = process.env.L2_RPC_URL; +if (!l1RpcUrl || !l2RpcUrl) { + throw new Error('L1_RPC_URL and L2_RPC_URL environment variables must be set.'); +}
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (2 hunks)
- public/tutorials/sdk-trace-txns.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (1)
Pattern
**/*.mdx
: "ALWAYS review Markdown content THOROUGHLY with the following criteria:
- Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
- Avoid gender-specific language and use the imperative form.
- Monitor capitalization for emphasis. Use bold for prominence instead of all caps or italics.
- Ensure proper nouns are capitalized in sentences.
- Apply the Oxford comma.
- Use proper title case for headers, buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
- Use correct spelling and grammar at all times (IMPORTANT).
"
🔇 Additional comments (2)
pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (2)
4-4
: LGTM: Updated description accurately reflects the tutorial content.The description has been appropriately updated to mention the viem library instead of the Optimism SDK, which aligns with the changes made throughout the tutorial.
70-72
: LGTM: Dependency import updated to use viem.The import statement has been correctly updated to use the viem library instead of the Optimism SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs a tech review so I'm happy to review again later, but this look great to me! Just make sure to update the headers to comply with the new style
For all of these tutorials usually there is a step for running the command
|
@ZakAyesh Updated the tut, can you take a second review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the chains are not imported, they should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (1)
49-55
: LGTM with a minor suggestion.The changes accurately reflect the use of viem's
getTransactionReceipt
function and provide appropriate RPC URLs for test networks. The explanation about using an RPC provider that supports indexed event queries is helpful for users.Consider adding a brief note explaining that these are test network URLs and that users should use mainnet URLs for production environments.
pages/builders/app-developers/transactions/estimates.mdx (1)
Line range hint
1-24
: Overall adherence to coding guidelines is commendable.The document generally follows the provided coding guidelines, including:
- Use of proper nouns instead of personal pronouns
- Appropriate capitalization for emphasis
- Correct capitalization of proper nouns in sentences
- Consistent use of the Oxford comma
- Proper title case for headers
- Correct spelling and grammar
To ensure complete compliance, a final proofreading of the entire document is recommended.
Consider performing a final proofreading pass to catch any minor inconsistencies that may have been overlooked.
🧰 Tools
🪛 LanguageTool
[style] ~26-~26: ‘exactly the same’ might be wordy. Consider a shorter alternative.
Context: ...> A transaction's execution gas fee is exactly the same fee that you would pay for the same tra...(EN_WORDINESS_PREMIUM_EXACTLY_THE_SAME)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- pages/builders/app-developers/transactions/estimates.mdx (1 hunks)
- pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
pages/builders/app-developers/transactions/estimates.mdx (1)
Pattern
**/*.mdx
: "ALWAYS review Markdown content THOROUGHLY with the following criteria:
- Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
- Avoid gender-specific language and use the imperative form.
- Monitor capitalization for emphasis. Use bold for prominence instead of all caps or italics.
- Ensure proper nouns are capitalized in sentences.
- Apply the Oxford comma.
- Use proper title case for headers, buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
- Use correct spelling and grammar at all times (IMPORTANT).
"pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (1)
Pattern
**/*.mdx
: "ALWAYS review Markdown content THOROUGHLY with the following criteria:
- Use proper nouns in place of personal pronouns like 'We' and 'Our' to maintain consistency in communal documentation.
- Avoid gender-specific language and use the imperative form.
- Monitor capitalization for emphasis. Use bold for prominence instead of all caps or italics.
- Ensure proper nouns are capitalized in sentences.
- Apply the Oxford comma.
- Use proper title case for headers, buttons, tab names, page names, and links. Sentence case should be used for body content and short phrases, even in links.
- Use correct spelling and grammar at all times (IMPORTANT).
"
🔇 Additional comments (14)
pages/builders/app-developers/tutorials/sdk-trace-txns.mdx (14)
4-4
: LGTM: Description updated correctly.The description has been appropriately updated to reflect the use of the viem library instead of the Optimism SDK, accurately representing the content of the updated tutorial.
10-12
: LGTM: Introduction updated correctly.The introduction has been appropriately updated to reflect the use of the viem library instead of the Optimism SDK. The link to the viem library documentation is correctly provided, which is helpful for users who want to learn more about the library.
22-23
: LGTM: Project setup instructions updated correctly.The project setup instructions have been appropriately updated to reflect the use of the viem library instead of the Optimism SDK. This change is consistent with the overall update of the tutorial.
59-64
: LGTM: Helpful Node REPL instructions added.The addition of instructions for starting and using the Node REPL is beneficial, especially for users who may be new to this environment. The explanation is clear and concise, which will help users follow the tutorial more easily.
70-72
: LGTM: Viem import statement added correctly.The import statement for viem has been correctly added, which is consistent with the use of viem throughout the updated tutorial.
76-81
: LGTM: RPC URL import instructions added.The instructions for importing RPC URLs have been clearly added and are consistent with the earlier introduction of these URLs. The use of environment variables for managing configuration is a good practice that has been correctly implemented here.
86-88
: LGTM: Deposit transaction hash setup instructions added.The instructions for setting up a deposit transaction hash have been clearly added. The explanation about deposit tracing being based on the transaction hash is helpful for users' understanding. The flexibility to use a custom transaction hash is a good feature for users following the tutorial.
93-95
: LGTM: Withdrawal transaction hash setup instructions added.The instructions for setting up a withdrawal transaction hash have been clearly added. The explanation about withdrawal tracing being based on the transaction hash is helpful and consistent with the previous deposit transaction hash setup. The flexibility to use a custom transaction hash is maintained, which is beneficial for users following the tutorial.
100-100
: LGTM: RPC provider creation updated to use viem.The code snippet for creating RPC providers has been correctly updated to use viem's
createPublicClient
function. The creation of separate clients for L1 and L2 is appropriate and consistent with the tutorial's purpose of tracing transactions across both layers.
105-119
: LGTM: Deposit tracing instructions updated to use viem.The instructions for tracing a deposit have been appropriately updated to use viem functions. The step-by-step guidance is clear and demonstrates the correct use of viem's
getTransactionReceipt
function. These changes are consistent with the overall update to use viem instead of the Optimism SDK throughout the tutorial.
124-127
: LGTM: Deposit log parsing instructions added.The addition of instructions for parsing deposit logs is a valuable inclusion. It demonstrates how to use viem's functions to extract detailed information from the transaction logs, which is helpful for users who need to perform more in-depth analysis of their deposits.
131-133
: LGTM: Deposit transaction retrieval updated to use viem.The instructions for getting the deposit transaction have been correctly updated to use viem. The changes are consistent with the overall update of the tutorial, and they clearly demonstrate how to query for the L2 transaction that executed the deposit using viem's functions.
138-151
: LGTM: Withdrawal tracing instructions updated to use viem.The instructions for tracing a withdrawal have been appropriately updated to use viem functions. The step-by-step guidance is clear and demonstrates the correct use of viem's functions for getting withdrawal status and transaction receipt. These changes are consistent with the overall update to use viem instead of the Optimism SDK throughout the tutorial.
156-159
: LGTM: Withdrawal log parsing instructions added.The addition of instructions for parsing withdrawal logs is a valuable inclusion. It demonstrates how to use viem's functions to extract detailed information from the transaction logs, which is helpful for users who need to perform more in-depth analysis of their withdrawals.
Co-authored-by: Bradley Camacho <[email protected]>
Co-authored-by: Bradley Camacho <[email protected]>
|
||
```js file=<rootDir>/public/tutorials/sdk-trace-txns.js#L10-L11 hash=02141d8cb077764665c61fc48e18ed04 | ||
``` | ||
```js file=<rootDir>/public/tutorials/sdk-trace-txns.js#L9-L10 hash=014f5d17eddb45fc081c7db9f33361b4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Earlier in the tutorial we exported the RPC URL as an environment variable, should we just use that rather than declaring a new variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it seems the L2 RPC is missing a variable here which is necessary for the code below
Description
This tutorial explains how you can use the Viem race a deposit or withdrawal transaction between L1 and L2. It deprecates the Optimism SDK.
Tests
Additional context
Metadata