Replace viem with existing ethereumjs dependencies in sdk-coin-tempo#7836
Closed
Replace viem with existing ethereumjs dependencies in sdk-coin-tempo#7836
Conversation
- Replace viem type imports (Address, Hex) with custom type aliases - Replace viem.isAddress() with ethereumjs-util.isValidAddress() - Replace viem.parseUnits()/formatUnits() with BigNumber-based implementations - Replace viem.encodeFunctionData() with ethereumjs-abi.methodID() and rawEncode() - Replace viem.pad()/toHex() with ethereumjs-util.setLengthLeft()/bufferToHex() - Replace viem.getAddress() with ethereumjs-util.toChecksumAddress() in tests - Remove viem dependency from package.json - Add required dependencies: bignumber.js, ethereumjs-abi, ethereumjs-util Co-authored-by: OttoAllmendinger <283533+OttoAllmendinger@users.noreply.github.com>
- Use setLengthRight instead of setLengthLeft for bytes32 memo padding (strings are left-aligned in Solidity) - Convert bigint to hex string for proper ABI encoding - Apply consistent padding for both empty and non-empty memos Co-authored-by: OttoAllmendinger <283533+OttoAllmendinger@users.noreply.github.com>
- Use amount.toString() for ethereumjs-abi encoding (simpler and works correctly) - Remove unnecessary hex conversion step Co-authored-by: OttoAllmendinger <283533+OttoAllmendinger@users.noreply.github.com>
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Update on addressing feedback about using viem library
Replace viem with existing ethereumjs dependencies in sdk-coin-tempo
Jan 5, 2026
08d9231 to
6dd03fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
sdk-coin-tempomodule introducedviemas a dependency for Ethereum utilities (address validation, ABI encoding, unit conversion). This adds unnecessary weight when equivalent functionality exists inethereumjs-util,ethereumjs-abi, andbignumber.js- already used throughout the monorepo.Changes
Removed viem dependency
viemfrom package.jsonethereumjs-util,ethereumjs-abi,bignumber.js(versions matchabstract-eth)Type definitions (
src/lib/types.ts)AddressandHextypes: viem imports → custom type aliases (string)Utility functions (
src/lib/utils.ts)viem.isAddress()→ethereumjs-util.isValidAddress()viem.parseUnits()/formatUnits()→BigNumber-based implementationsviem.encodeFunctionData()→ethereumjs-abi.methodID()+rawEncode()viem.pad()/toHex()→ethereumjs-util.setLengthRight()/bufferToHex()Test files
viem.getAddress()→ethereumjs-util.toChecksumAddress()Example
Before:
After:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.