Skip to content

Commit

Permalink
adds number getter for BlockTags with number
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinczenko committed Dec 10, 2024
1 parent 037bef0 commit c7c5711
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ethers/blocktag.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pkg/stint
import pkg/questionable

{.push raises:[].}

Expand Down Expand Up @@ -41,3 +42,10 @@ func `==`*(a, b: BlockTag): bool =
a.stringValue == b.stringValue
of numberBlockTag:
a.numberValue == b.numberValue

func number*(blockTag: BlockTag): ?UInt256 =
case blockTag.kind
of stringBlockTag:
UInt256.none
of numberBlockTag:
blockTag.numberValue.some

0 comments on commit c7c5711

Please sign in to comment.