get_info: remove with_scan argument (#306)

* get_info: remove with_scan argument

* Fix binding tests

* Update dart test and kotlin example app

* Update RN example app
This commit is contained in:
ok300
2024-06-12 13:23:32 +00:00
committed by GitHub
parent a2936500a3
commit 31e2ab44af
26 changed files with 74 additions and 406 deletions

View File

@@ -117,38 +117,6 @@ fun asConnectRequestList(arr: ReadableArray): List<ConnectRequest> {
return list
}
fun asGetInfoRequest(getInfoRequest: ReadableMap): GetInfoRequest? {
if (!validateMandatoryFields(
getInfoRequest,
arrayOf(
"withScan",
),
)
) {
return null
}
val withScan = getInfoRequest.getBoolean("withScan")
return GetInfoRequest(
withScan,
)
}
fun readableMapOf(getInfoRequest: GetInfoRequest): ReadableMap =
readableMapOf(
"withScan" to getInfoRequest.withScan,
)
fun asGetInfoRequestList(arr: ReadableArray): List<GetInfoRequest> {
val list = ArrayList<GetInfoRequest>()
for (value in arr.toArrayList()) {
when (value) {
is ReadableMap -> list.add(asGetInfoRequest(value)!!)
else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}"))
}
}
return list
}
fun asGetInfoResponse(getInfoResponse: ReadableMap): GetInfoResponse? {
if (!validateMandatoryFields(
getInfoResponse,

View File

@@ -160,15 +160,10 @@ class BreezLiquidSDKModule(
}
@ReactMethod
fun getInfo(
req: ReadableMap,
promise: Promise,
) {
fun getInfo(promise: Promise) {
executor.execute {
try {
val getInfoRequest =
asGetInfoRequest(req) ?: run { throw LiquidSdkException.Generic(errMissingMandatoryField("req", "GetInfoRequest")) }
val res = getBindingLiquidSdk().getInfo(getInfoRequest)
val res = getBindingLiquidSdk().getInfo()
promise.resolve(readableMapOf(res))
} catch (e: Exception) {
promise.reject(e.javaClass.simpleName.replace("Exception", "Error"), e.message, e)