Skip to content

Commit

Permalink
fix: celo tx type detection - fixes #1863
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Mar 3, 2024
1 parent 1dafba5 commit 367eef3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-olives-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"viem": patch
---

Fixed issue where zero gas fees would bypass Celo's transaction type detection.
8 changes: 4 additions & 4 deletions src/chains/celo/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('isEIP1559', () => {
maxPriorityFeePerGas: 0n,
from: mockAddress,
}),
).toBe(false)
).toBe(true)

expect(
isEIP1559({
Expand All @@ -97,15 +97,15 @@ describe('isEIP1559', () => {
maxPriorityFeePerGas: 456n,
from: mockAddress,
}),
).toBe(false)
).toBe(true)

expect(
isEIP1559({
maxFeePerGas: 123n,
maxPriorityFeePerGas: 0n,
from: mockAddress,
}),
).toBe(false)
).toBe(true)

expect(
isEIP1559({
Expand Down Expand Up @@ -279,7 +279,7 @@ describe('isCIP64', () => {
maxPriorityFeePerGas: 456n,
from: mockAddress,
}),
).toBe(false)
).toBe(true)
})

expect(
Expand Down
4 changes: 2 additions & 2 deletions src/chains/celo/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export function isEIP1559(
transaction: CeloTransactionSerializable | CeloTransactionRequest,
): boolean {
return (
isPresent(transaction.maxFeePerGas) &&
isPresent(transaction.maxPriorityFeePerGas)
typeof transaction.maxFeePerGas !== 'undefined' &&
typeof transaction.maxPriorityFeePerGas !== 'undefined'
)
}

Expand Down

0 comments on commit 367eef3

Please sign in to comment.