Skip to content

Commit

Permalink
Remove asUInt parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
prashanDYDX committed Sep 11, 2024
1 parent 642b9e2 commit a225f2d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ interface ParserProtocol {
// parse a field to int
fun asInt(data: Any?): Int?

// parse a field to unsigned int
fun asUInt(data: Any?): UInt?

// parse a field to int
fun asLong(data: Any?): Long?

Expand Down
43 changes: 0 additions & 43 deletions src/commonMain/kotlin/exchange.dydx.abacus/utils/Parser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -216,49 +216,6 @@ class Parser : ParserProtocol {
return null
}

override fun asUInt(data: Any?): UInt? {
val jsonLiteral = data as? JsonPrimitive
if (jsonLiteral != null) {
return jsonLiteral.longOrNull?.toUInt()
}

val long = data as? Long
if (long != null) {
return long.toUInt()
}

val int = data as? Int
if (int != null) {
return int.toUInt()
}

val float = data as? Float
if (float != null) {
return float.toUInt()
}

val double = data as? Double
if (double != null) {
return double.toUInt()
}

val decimal = data as? BigDecimal
if (decimal != null) {
return decimal.doubleValue(false).toUInt()
}

val string = data as? String
if (string != null) {
return try {
string.toUInt()
} catch (e: Exception) {
null
}
}

return null
}

override fun asLong(data: Any?): Long? {
val jsonLiteral = data as? JsonPrimitive
if (jsonLiteral != null) {
Expand Down

0 comments on commit a225f2d

Please sign in to comment.