From a225f2d403aad6f893f63f569d7398bf387915c1 Mon Sep 17 00:00:00 2001 From: Prashan Dharmasena Date: Wed, 11 Sep 2024 18:22:01 -0400 Subject: [PATCH] Remove asUInt parsing --- .../protocols/ParserProtocol.kt | 3 -- .../exchange.dydx.abacus/utils/Parser.kt | 43 ------------------- 2 files changed, 46 deletions(-) diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/protocols/ParserProtocol.kt b/src/commonMain/kotlin/exchange.dydx.abacus/protocols/ParserProtocol.kt index c116a318e..4b4299a29 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/protocols/ParserProtocol.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/protocols/ParserProtocol.kt @@ -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? diff --git a/src/commonMain/kotlin/exchange.dydx.abacus/utils/Parser.kt b/src/commonMain/kotlin/exchange.dydx.abacus/utils/Parser.kt index f5f3620eb..dc84b2918 100644 --- a/src/commonMain/kotlin/exchange.dydx.abacus/utils/Parser.kt +++ b/src/commonMain/kotlin/exchange.dydx.abacus/utils/Parser.kt @@ -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) {