mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-16 12:34:22 +01:00
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:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user