[DOCS] A suggestion about Bridging ERC-20 Tokens with Viem
The documentation explicitly states in sections like Preparing for Optimism SDK deprecation that The Optimism SDK will be deprecated. As a result, the guide on Bridging ERC-20 tokens with viem needs to be updated.
Before the documentation is updated, this creates a gap. Would it be possible to provide some clarifications or progress updates? Potential additions could include:
- Status of the Optimism SDK: My research indicates that the package was last updated four months ago. Has the team decided to continue maintaining the existing features of the Optimism SDK, or will support for them be discontinued?
- Current support in Viem: Based on my findings, Viem has limited support for ERC-20 bridging. However, it is still possible for users to complete ERC-20 token bridging using Viem alone.
Unless I have missed any key information, I believe the Optimism SDK is currently more convenient than Viem for the tutorial's use case. In my discussion post, I highlighted some potential challenges when using Viem alone for this process.
I would appreciate any feedback on this issue and the discussion I shared.
Hey Simple, to address a couple of your points:
Status of the Optimism SDK: My research indicates that the package was last updated four months ago. Has the team decided to continue maintaining the existing features of the Optimism SDK, or will support for them be discontinued?
Support for them will be discontinued in favor of Viem.
Current support in Viem: Based on my findings, Viem has limited support for ERC-20 bridging. However, it is still possible for users to complete ERC-20 token bridging using Viem alone.
I believe OP Labs team has added these bindings to https://github.com/ethereum-optimism/ecosystem/tree/main/packages/viem. I'll ask the team internally and relay your feedback. Thanks!
Hey @opfocus! Thanks for bringing this up.
Good news - we've just addressed this exact issue in PR #1470, which provides a complete implementation for token bridging using viem. The PR adds working code examples for both L1→L2 deposits and L2→L1 withdrawals using the @eth-optimism/viem package that @sbvegan mentioned.
The implementation demonstrates:
- How to use depositERC20 for sending tokens to L2
- How to use withdrawOptimismERC20 for withdrawing tokens back to L1
- Proper error handling and balance checking
This should fill the gap in the documentation while we transition away from the SDK. The code is intentionally kept simple and beginner-friendly while still being production-ready in a way. Feel free to take a look at the PR and let us know if it addresses your concerns!
@opfocus We have closed out on this, i'm closing this ticket.