Skip to content

Mobile Keeper

Aleksandr Ershov edited this page Sep 27, 2019 · 11 revisions

Mobile keeper is part of Waves client app, it designed to send or sign transactions created in third-party applications, but keep your seed-phrase in the safe place and do not show it to that applications. It is care about Waves blockchain users safety.

For using Mobile keeper you must create an application with this Waves Mobile SDK, create one of allowed transactions and send it via special intent to keeper. User will see details of your transaction and accept or reject it. You can create two options for keeper: sign or send. Both ways returns signed transaction after user accept, but send also add transaction to Waves blockchain.

Now we support only three main types: transfer, data and invoke script transactions. In future keeper will support all types. You can find examples of transactions here and all examples of this tutotial is here

  1. Waves Android mobile keeper based on Waves-SDK

  2. Configure dApp before Waves Keeper using

class App : Application() {
    override fun onCreate() {
        super.onCreate()
        // You must configure dApp before Waves Keeper using eg. in Application-class
        WavesSdk.keeper().configureDApp(
            context = this,
            dAppName = "My Waves DApp", // Name of your dApp
            dAppIconUrl = "https://avatars2.githubusercontent.com/u/18295288") // Link to your dApp image

        // Also if you will send transaction via Waves Mobile SDK
        // you init like WavesSdk.init(this)
    }
}
  1. Prepare and send transaction to Waves keeper for add it to Waves blockchain or just get signification from it
    // Preparing Data transaction, use also TransferTransaction or InvokeScriptTransaction
    val dataTransaction = DataTransaction(
            mutableListOf(
                DataTransaction.Data("key0", "string", "This is Data TX"),
                DataTransaction.Data("key1", "integer", 100),
                DataTransaction.Data("key2", "integer", -100),
                DataTransaction.Data("key3", "boolean", true),
                DataTransaction.Data("key4", "boolean", false),
                DataTransaction.Data("key5", "binary", "SGVsbG8h")
            )
        )
    
    // 1. Data transaction to Waves keeper for send
    WavesSdk.keeper().send(fragmentActivity, dataTransaction, // Your prepared data transaction
        object : KeeperCallback<DataTransactionResponse> {    // Keeper response listener 
            override fun onSuccess(result: KeeperResult.Success<DataTransactionResponse>) {
                // Return success response transaction from blockchain in result
                // Check your transaction at https://wavesexplorer.com/tx/<TXID>
                Log.d("KEEPERTEST", "TXID: " + result.transaction?.id)
            }

            override fun onFailed(error: KeeperResult.Error) {
                // Return failed or reject response transaction from blockchain in result
                Log.d("KEEPERTEST", error.toString())
            }
        })

    // 2. Data transaction to Waves keeper for sign
    WavesSdk.keeper().sign(fragmentActivity, dataTransaction, // Your prepared data transaction
        object : KeeperCallback<DataTransaction> {            // Keeper response listener 
            override fun onSuccess(result: KeeperResult.Success<DataTransaction>) {
                // Return success transaction with signature in proofs-field
                Log.d("KEEPERTEST", result.toString())
            }
 
            override fun onFailed(error: KeeperResult.Error) {
                // Return failed or reject decision of user
                Log.d("KEEPERTEST", error.toString())
            }
        })

Check your transaction at wavesexplorer.com or wavesexplorer.com/testnet

Tap 10 times on Waves logo on sidebar menu in Android Waves client application to turn on developer option with TestNet.

After transaction signification you can send transaction to blockchain. Remember timestamp valid for +/- 90 min and you can't change timestamp without changes in signature.

Clone this wiki locally