Skip to main content

Establishing a connection

A connection to Coinbase Wallet can be initiated by calling the initiateHandshake function provided by the SDK. The function also takes in an optional initialActions parameter which apps can use to take certain actions along with the initial handshake request.

val requestAccount = Web3JsonRPC.RequestAccounts().action()
val handShakeActions = listOf(requestAccount)

client.initiateHandshake(
initialActions = handShakeActions
) { result: Result<List<ActionResult>>, account: Account? ->
result.onSuccess { actionResults: List<ActionResult> ->
actionResults.handleSuccess("Handshake", handShakeActions, account)
}
result.onFailure { err ->
err.handleError("HandShake")
}
}

An example handshake request is provided in the sample application.

Was this helpful?