Skip to content

Commit

Permalink
✨Implement onSessionUpdate callback
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsinsar committed Jun 18, 2021
1 parent 4679338 commit d01e09f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ open class WCClient (

var remotePeerId: String? = null
private set

var chainId: String? = null
private set

Expand All @@ -82,6 +82,7 @@ open class WCClient (
var onBnbTxConfirm: (id: Long, order: WCBinanceTxConfirmParam) -> Unit = { _, _ -> Unit }
var onGetAccounts: (id: Long) -> Unit = { _ -> Unit }
var onSignTransaction: (id: Long, transaction: WCSignTransaction) -> Unit = {_, _ -> Unit }
var onSessionUpdate: (id: Long, sessionUpdate: WCSessionUpdate) -> Unit = { _, _ -> Unit }

override fun onOpen(webSocket: WebSocket, response: Response) {
Log.d(TAG, "<< websocket opened >>")
Expand Down Expand Up @@ -271,6 +272,7 @@ open class WCClient (
if (!param.approved) {
killSession()
}
onSessionUpdate(request.id, param)
}
WCMethod.ETH_SIGN -> {
val params = gson.fromJson<List<String>>(request.params)
Expand Down Expand Up @@ -334,7 +336,7 @@ open class WCClient (
}
}
}

private fun subscribe(topic: String): Boolean {
val message = WCSocketMessage(
topic = topic,
Expand Down

0 comments on commit d01e09f

Please sign in to comment.