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

chore(deps): upgrade viem to ^2.7.16 #5022

Merged
merged 5 commits into from
Mar 4, 2024
Merged

chore(deps): upgrade viem to ^2.7.16 #5022

merged 5 commits into from
Mar 4, 2024

Conversation

satish-ravi
Copy link
Contributor

@satish-ravi satish-ravi commented Mar 2, 2024

Description

Includes some typing changes.

  • WalletActions need a more specific account type, it doesn't like the undefined part of Account | undefined
  • baseFeePerGas from getBlock returns BigInt | null, which I believe has always been the case. In previous versions, we were getting back any as the type which was assigned to BigInt. Now we throw if it's null as it can only be null in blocks prior to the EIP-1559 upgrade

Test plan

CI

Related issues

Backwards compatibility

Yes

Copy link

codecov bot commented Mar 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.52%. Comparing base (a78b23a) to head (74919b0).
Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5022      +/-   ##
==========================================
+ Coverage   85.48%   85.52%   +0.04%     
==========================================
  Files         724      724              
  Lines       29538    29612      +74     
  Branches     5101     5127      +26     
==========================================
+ Hits        25251    25327      +76     
- Misses       4048     4050       +2     
+ Partials      239      235       -4     
Files Coverage Δ
src/viem/estimateFeesPerGas.ts 100.00% <100.00%> (ø)
src/viem/getLockableWallet.ts 95.12% <100.00%> (ø)

... and 27 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a78b23a...74919b0. Read the comment docs.

@@ -9,7 +9,7 @@ import {
export async function estimateFeesPerGas(
client: Client,
feeCurrency?: Address
): Promise<{ maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; baseFeePerGas: bigint }> {
): Promise<{ maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; baseFeePerGas: bigint | null }> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baseFeePerGas from getBlock now has a type of BigInt | null, it used to be any in prior versions. Looks like this will always be returned for the latest block, it's only null for older blocks before the EIP 1559 upgrade https://www.quicknode.com/docs/ethereum/eth_getBlockByHash. Another option to fix this would be to just throw if this is null as it would never happen in practice for the latest block.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference for throwing here, since we're only dealing with EIP-1559 based TXs in the rest of the code.

Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@@ -9,7 +9,7 @@ import {
export async function estimateFeesPerGas(
client: Client,
feeCurrency?: Address
): Promise<{ maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; baseFeePerGas: bigint }> {
): Promise<{ maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; baseFeePerGas: bigint | null }> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference for throwing here, since we're only dealing with EIP-1559 based TXs in the rest of the code.

@satish-ravi satish-ravi added this pull request to the merge queue Mar 4, 2024
Merged via the queue into main with commit 722017d Mar 4, 2024
16 checks passed
@satish-ravi satish-ravi deleted the satish/upgrade-viem branch March 4, 2024 19:39
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
### Description

Includes some typing changes.
- WalletActions need a more specific account type, it doesn't like the
`undefined` part of `Account | undefined`
- `baseFeePerGas` from `getBlock` returns `BigInt | null`, which I
believe has always been the case. In previous versions, we were getting
back `any` as the type which was assigned to `BigInt`. Now we throw if
it's null as it can only be null in blocks prior to the EIP-1559 upgrade

### Test plan

CI

### Related issues

- Fixes ACT-1111

### Backwards compatibility

Yes
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.

None yet

2 participants